Commit 3a5fd9a2 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

update logger

parent 2a760b4a
...@@ -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 ...")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment