-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add debug flag to run in debug mode (useful for gdb) and use logger instead of print.
- Loading branch information
1 parent
e7b2794
commit 02d6f65
Showing
5 changed files
with
101 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# -*- coding: utf-8 -*- | ||
import os | ||
import logging | ||
import logging.config | ||
|
||
|
||
LOG_LEVEL = os.getenv('LOG_LEVEL', 'INFO') | ||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': True, | ||
'formatters': { | ||
'verbose': { | ||
'format': "[%(asctime)s] %(levelname)s " \ | ||
"[%(threadName)s:%(lineno)s] %(message)s", | ||
'datefmt': "%Y-%m-%d %H:%M:%S" | ||
}, | ||
'simple': { | ||
'format': '%(levelname)s %(message)s' | ||
}, | ||
}, | ||
'handlers': { | ||
'console': { | ||
'level': LOG_LEVEL, | ||
'class': 'logging.StreamHandler', | ||
'formatter': 'verbose' | ||
}, | ||
'file': { | ||
'level': LOG_LEVEL, | ||
'class': 'logging.handlers.RotatingFileHandler', | ||
'formatter': 'verbose', | ||
'filename': 'rl.log', | ||
'maxBytes': 10*10**6, | ||
'backupCount': 3 | ||
} | ||
}, | ||
'loggers': { | ||
'': { | ||
'handlers': ['console', 'file'], | ||
'level': LOG_LEVEL, | ||
}, | ||
} | ||
} | ||
|
||
|
||
logging.config.dictConfig(LOGGING) | ||
|
||
def getLogger(name): | ||
|
||
return logging.getLogger(name) |