Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dedal
Manage
Activity
Members
Labels
Plan
Issues
2
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
464f9abd
Commit
464f9abd
authored
1 month ago
by
Adrian Ciu
Browse files
Options
Downloads
Patches
Plain Diff
esd: added logger class and fixed bug
parent
ecbbfecf
No related branches found
Branches containing commit
No related tags found
2 merge requests
!7
Dedal Release
,
!3
Draft: Esd spack installation
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dedal/logger/logger_config.py
+33
-0
33 additions, 0 deletions
dedal/logger/logger_config.py
with
33 additions
and
0 deletions
dedal/logger/logger_config.py
0 → 100644
+
33
−
0
View file @
464f9abd
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