init
This commit is contained in:
23
src/rzhdweb/zlogging.py
Normal file
23
src/rzhdweb/zlogging.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger('rzhdweb')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
formatter = logging.Formatter(
|
||||
'%(asctime)s - %(name)s - %(module)s:%(lineno)d - %(levelname)s\n %(message)s')
|
||||
|
||||
debug_file = logging.FileHandler('debug.log')
|
||||
debug_file.setLevel(logging.DEBUG)
|
||||
debug_file.setFormatter(formatter)
|
||||
logger.addHandler(debug_file)
|
||||
|
||||
warning_file = logging.FileHandler('warning.log')
|
||||
warning_file.setLevel(logging.WARNING)
|
||||
warning_file.setFormatter(formatter)
|
||||
logger.addHandler(warning_file)
|
||||
|
||||
info_console = logging.StreamHandler()
|
||||
info_console.setLevel(logging.INFO)
|
||||
# info_console.setLevel(logging.WARNING)
|
||||
info_console.setFormatter(formatter)
|
||||
logger.addHandler(info_console)
|
Reference in New Issue
Block a user