mirror of
https://github.com/Kiritow/wg-ops.git
synced 2024-03-22 13:11:37 +08:00
add logger
This commit is contained in:
parent
e60b5c2f37
commit
1c70e0b32c
10
logger.py
Normal file
10
logger.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import logging
|
||||||
|
|
||||||
|
def get_logger(name=None):
|
||||||
|
logger = logging.getLogger(name)
|
||||||
|
if not logger.hasHandlers():
|
||||||
|
console_handler = logging.StreamHandler()
|
||||||
|
console_handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(funcName)s: %(message)s"))
|
||||||
|
logger.addHandler(console_handler)
|
||||||
|
logger.setLevel(logging.INFO)
|
||||||
|
return logger
|
Loading…
Reference in New Issue
Block a user