Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dedal
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Harbor Registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
EBRAINS RI
Tech Hub
Platform
EBRAINS Software Distribution
dedal
Commits
924d4076
Commit
924d4076
authored
3 months ago
by
Adrian Ciu
Browse files
Options
Downloads
Patches
Plain Diff
esd: added logger class and fixed bug
parent
6471bd2d
No related branches found
No related tags found
1 merge request
!4
feat(spack_operation): implement setup_spack_env functionality
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
esd/logger/logger_config.py
+33
-0
33 additions, 0 deletions
esd/logger/logger_config.py
with
33 additions
and
0 deletions
esd/logger/logger_config.py
0 → 100644
+
33
−
0
View file @
924d4076
import
logging
class
LoggerConfig
:
"""
This class sets up logging with a file handler
and a stream handler, ensuring consistent
and formatted log messages.
"""
def
__init__
(
self
,
log_file
):
self
.
log_file
=
log_file
self
.
_configure_logger
()
def
_configure_logger
(
self
):
formatter
=
logging
.
Formatter
(
fmt
=
'
%(asctime)s - %(levelname)s - %(message)s
'
,
datefmt
=
'
%Y-%m-%d %H:%M:%S
'
)
file_handler
=
logging
.
FileHandler
(
self
.
log_file
)
file_handler
.
setFormatter
(
formatter
)
stream_handler
=
logging
.
StreamHandler
()
stream_handler
.
setFormatter
(
formatter
)
self
.
logger
=
logging
.
getLogger
(
__name__
)
self
.
logger
.
setLevel
(
logging
.
DEBUG
)
self
.
logger
.
addHandler
(
file_handler
)
self
.
logger
.
addHandler
(
stream_handler
)
def
get_logger
(
self
):
return
self
.
logger
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment