Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
csst-pipeline
csst_common
Commits
1e398d53
Commit
1e398d53
authored
Dec 10, 2023
by
BO ZHANG
🏀
Browse files
default logger does not write to file
parent
ab27dee5
Changes
1
Show whitespace changes
Inline
Side-by-side
csst_common/logger.py
View file @
1e398d53
...
...
@@ -10,9 +10,10 @@ Modified-History:
2022-10-07, Bo Zhang, added Numpydoc docstring
"""
import
logging
from
typing
import
Optional
def
get_logger
(
name
:
str
=
"CSST pipeline"
,
filename
:
str
=
"test.log"
):
def
get_logger
(
name
:
str
=
"CSST pipeline"
,
filename
:
Optional
[
str
]
=
None
):
"""
Get a logger for CSST pipelines.
...
...
@@ -59,7 +60,7 @@ def get_logger(name: str = "CSST pipeline", filename: str = "test.log"):
logger
.
addHandler
(
stream_handler
)
# file handler
if
filename
!=
""
:
if
filename
is
not
None
:
file_handler
=
logging
.
FileHandler
(
filename
=
filename
,
encoding
=
"utf-8"
)
file_handler
.
setFormatter
(
formatter
)
file_handler
.
setLevel
(
logging
.
INFO
)
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment