Python log wrapper
Project description
README
Table of Contents
Python log wrapper
Example configuration
[log]
to_console = true
console_level = 'DEBUG'
to_file = true
format = '%(asctime)s | %(levelname)-8s | <%(threadName)s> %(module)s.%(funcName)s [%(lineno)d]: %(message)s'
to_console
: whether to output log to STDOUT, use it during debugging, and close it during formal deploymentconsole_level
: log level, optional values are 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'to_file
: whether to output log to fileformat
: format of the log
Usage
from logwrapper import get_logger
log_conf = {
'to_console': True,
'console_level': 'DEBUG',
'to_file': True,
'format': '''%(asctime)s | %(levelname)-8s | <%(threadName)s> %(module)s.%(funcName)s [%(lineno)d]: %(message)s'''
}
def main():
"""docstring for main"""
logger = get_logger(logfolder='logs', config=log_conf)
logger.warning('Warning text')
logger.error('Error text')
logger.critical('Error text')
if __name__ == "__main__":
main()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
logwrapper-0.1.0.tar.gz
(15.4 kB
view hashes)
Built Distribution
logwrapper-0.1.0-py3-none-any.whl
(15.7 kB
view hashes)
Close
Hashes for logwrapper-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e86283470015afaaab8695ec3d7dcc5cc268900b8cc7878da69cede23c1a953e |
|
MD5 | 215670b65a02bb394af37bd5e8628e4d |
|
BLAKE2b-256 | 37955b8072892fca981dfaf18c1a9b16e6c2a1ca9677ce17bffb38884fa79171 |