add logging
This commit is contained in:
parent
96f7c3725b
commit
8b07649512
1 changed files with 16 additions and 5 deletions
|
@ -1,7 +1,18 @@
|
|||
import os
|
||||
import logging
|
||||
|
||||
logging.basicConfig(
|
||||
filename='pytex.log',
|
||||
encoding='utf-8',
|
||||
level=logging.INFO
|
||||
)
|
||||
formatter = logging.Formatter("[{name}] [{levelname}] {message}", style="{")
|
||||
|
||||
console_logger = logging.StreamHandler()
|
||||
console_logger.setLevel(logging.INFO)
|
||||
console_logger.setFormatter(formatter)
|
||||
|
||||
debug_logger = logging.StreamHandler()
|
||||
debug_logger.setLevel(logging.DEBUG)
|
||||
debug_logger.setFormatter(formatter)
|
||||
|
||||
logger: logging.Logger = logging.getLogger('PyTeX')
|
||||
|
||||
logger.setLevel(logging.INFO)
|
||||
logger.addHandler(console_logger)
|
||||
logger.addHandler(debug_logger)
|
||||
|
|
Loading…
Reference in a new issue