A simple high level logger wrapper to log into console/file with different level.
Project description
Plogger
Plogger - a simple high level logger wrapper to log into console/file with different level. Used built-in logger module.
Result
2020-01-08 02:03:47 [NAME] [LINE:21] [WARNING] log it as warning
2020-01-08 02:03:47 [NAME] [LINE:22] [INFO] log it as info level
Installation
For most users, the recommended method to install is via pip:
pip install plogger
Import
from plogger import Logger
Usage
- As standalone logger:
from plogger import Logger
logger = Logger('test', console=True, file=True) # Log into file too
logger().info('log this')
logger.logger.info('and log this too')
- As part of class using inheritance:
from plogger import Logger
class MyClass(Logger):
def __init__(self, logger_enabled=True, *args, **kwargs):
super().__init__(name=self.__class__.__name__, enabled=logger_enabled, *args, **kwargs)
def method_name(self):
self.logger.info('method_name invoked')
- Another yet usage way
from plogger import Logger
logger = Logger('NAME').__call__()
logger.warning('log it as warning')
logger.info('log it as info level')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
plogger-0.0.1a2.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for plogger-0.0.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e40f09553156f3d28d9d6c515095bbc3ff09768b93ce50c7f47159030b73c9a9 |
|
MD5 | 477334f9977e4f405f6bb5f44078cee7 |
|
BLAKE2b-256 | acecc1c7ba3b2a9a5b4d83b26c9c3e760ff24b47f7e3b524a11be23d0585e40e |