Python-Logging-For-Human / lazy_logger

ezlogging
8 stars 2 forks source link

Build Status

lazy_logger

__lazy_logger__ is a tool helping you to easily use Python's logging module by Python's print function.

Quick start

Requirements

Install

by pip

pip install lazy_logger

Usage

# 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()

test

py.test --capture=sys

Thanks the contributions