__lazy_logger__ is a tool helping you to easily use Python's logging
module by Python's print
function.
by pip
pip install lazy_logger
# demo.py
import lazy_logger
import sys
logger = lazy_logger.get_logger()
lazy_logger.log_to_console(logger)
lazy_logger.log_to_rotated_file(logger)
@logger.patch
def main():
print('Hello World!') # expect acting as logger
print('Hello stdout!', file=sys.stdout) # expect acting as normal print
if __name__ == '__main__':
main()
@logger.patch
: decorator making print
without file argument to logger which you configured belowlog_to_console()
: set logger for sending the message to stderrlog_to_rotated_file()
: set logger for saving the message in file (default: log.out) and rotating at same timelog_to_syslogd():
set logger for sending data to sysemdpy.test --capture=sys