Skip to main content

A simple high level logger wrapper to log into console/file with different level.

Project description

PyPI version Build Status Coverage Status

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for plogger, version 0.0.1a2
Filename, size File type Python version Upload date Hashes
Filename, size plogger-0.0.1a2-py3-none-any.whl (3.6 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size plogger-0.0.1a2.tar.gz (2.8 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page