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
3a5fd9a2
Commit
3a5fd9a2
authored
Dec 10, 2023
by
BO ZHANG
🏀
Browse files
update logger
parent
2a760b4a
Changes
1
Hide whitespace changes
Inline
Side-by-side
csst_common/logger.py
View file @
3a5fd9a2
...
@@ -48,7 +48,9 @@ def get_logger(name="CSST L1 Pipeline", filename=""):
...
@@ -48,7 +48,9 @@ def get_logger(name="CSST L1 Pipeline", filename=""):
logger
.
setLevel
(
logging
.
DEBUG
)
logger
.
setLevel
(
logging
.
DEBUG
)
# logging formatter
# logging formatter
formatter
=
logging
.
Formatter
(
"%(asctime)s - %(levelname)s - %(module)s.py:%(lineno)d - %(message)s"
)
formatter
=
logging
.
Formatter
(
"%(asctime)s - %(levelname)s - %(module)s.py:%(lineno)d - %(message)s"
)
# stream handler
# stream handler
stream_handler
=
logging
.
StreamHandler
()
stream_handler
=
logging
.
StreamHandler
()
...
@@ -68,9 +70,11 @@ def get_logger(name="CSST L1 Pipeline", filename=""):
...
@@ -68,9 +70,11 @@ def get_logger(name="CSST L1 Pipeline", filename=""):
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
import
os
import
os
print
(
os
.
getcwd
())
print
(
os
.
getcwd
())
logger
=
get_logger
(
filename
=
"test_logger.log"
)
logger
=
get_logger
(
filename
=
"test_logger.log"
)
print
(
type
(
logger
),
logger
.
name
)
print
(
"Type of logger:"
,
type
(
logger
))
print
(
"Name of logger:"
,
logger
.
name
)
logger
.
debug
(
"Well .."
)
logger
.
debug
(
"Well .."
)
logger
.
info
(
"Hello ..."
)
logger
.
info
(
"Hello ..."
)
logger
.
warning
(
"There ..."
)
logger
.
warning
(
"There ..."
)
...
...
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