doc/log
This commit is contained in:
parent
e9d228ba2c
commit
149ed2dc3b
1 changed files with 12 additions and 2 deletions
|
@ -5,7 +5,12 @@ import sys
|
||||||
|
|
||||||
|
|
||||||
def get_file_logger(name: str) -> logging.Logger:
|
def get_file_logger(name: str) -> logging.Logger:
|
||||||
"""Return a file logger."""
|
"""Return a file logger.
|
||||||
|
|
||||||
|
:param name: arbitrary name
|
||||||
|
:type name: str
|
||||||
|
:rtype: logging.Logger
|
||||||
|
"""
|
||||||
# formatter
|
# formatter
|
||||||
items = [
|
items = [
|
||||||
"%(name)s: %(asctime)s",
|
"%(name)s: %(asctime)s",
|
||||||
|
@ -27,7 +32,12 @@ def get_file_logger(name: str) -> logging.Logger:
|
||||||
|
|
||||||
|
|
||||||
def get_stream_logger(level: int) -> logging.Logger:
|
def get_stream_logger(level: int) -> logging.Logger:
|
||||||
"""Return a stream logger."""
|
"""Return a stream logger.
|
||||||
|
|
||||||
|
:param level: filtering level
|
||||||
|
:type level: int
|
||||||
|
:rtype: logging.Logger
|
||||||
|
"""
|
||||||
# handler
|
# handler
|
||||||
out_handler = logging.StreamHandler(stream=sys.stdout)
|
out_handler = logging.StreamHandler(stream=sys.stdout)
|
||||||
out_handler.setLevel(level)
|
out_handler.setLevel(level)
|
||||||
|
|
Loading…
Reference in a new issue