Skip to main content

A simple Logging generalizer

Project description

LE Logging Library

Installation:

pip install le-logging

This library defines a standardized logging pattern for all Python based Projects inside LE Environment.

It's based on Pythons integrated Logging System and makes it easy to use without redefining Layouts and Rotations manually for every project.

It's mandatory to generalize Logs to simplify debugging and problem solving.

Available Log Levels are defined as ENUM

class Level(Enum):
    DEBUG = 10
    INFO = 20
    WARNING = 30
    ERROR = 40
    CRITICAL = 50

The usage of the Library is simple:

Defining a Rotating LogFile based on filesize:

attribut is the maximum file size in Megabytes [Default is 32MB]
max_backup attribut defines the maximum stored Files before overwriting existing Files [Default is 14 Files]
# Defining loglevel as integer:
from le_logging import RotatingLog

log = RotatingLog(name="Testlog", max_backups=5, max_size=64, level=10)
# Defining LogLevel based on Enum
from le_logging import RotatingLog, Level

log = RotatingLog(name="Testlog", max_backups=5, max_size=64, level=Level.DEBUG)
# Defining specific Path
from le_logging import RotatingLog, Level

log = RotatingLog(name="Testlog", path="/var/log", max_backups=5, max_size=64, level=Level.DEBUG)

Defining a Timed Rotating LogFile based on filesize:

# Defining loglevel as integer:
from le_logging import TimedRotatingLog

log = TimedRotatingLog(name="Testlog", max_backups=5, max_size=64, level=10)
# Defining LogLevel based on Enum
from le_logging import TimedRotatingLog, Level

log = TimedRotatingLog(name="TimedTestlog", max_backups=5, timer=1, level=Level.DEBUG)
# Defining specific Path
from le_logging import TimedRotatingLog, Level

log = TimedRotatingLog(name="TimedTestlog", path="/var/log", max_backups=5, timer=1, level=Level.DEBUG)

Using defined LogFiles

log.debug("This is a DEBUG message")
log.info("This is an INFO message")
log.warn("This is a warn message")
log.error("This is an ERROR message")
log.critical("This is a CRITICAL message")

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

le_logging-0.2.0.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

le_logging-0.2.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file le_logging-0.2.0.tar.gz.

File metadata

  • Download URL: le_logging-0.2.0.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for le_logging-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0c22974baf857840d25412496bf148ffb359afe1d6d6e4f5333b75fadd1b243a
MD5 64fe1ad25ed100d98564bcd55dabb660
BLAKE2b-256 2eb00a391db94a3e7b2411c04ef8afca0df8826a76c1c5c0875e946c4753a19c

See more details on using hashes here.

File details

Details for the file le_logging-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: le_logging-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for le_logging-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2c779005b64ce717bdfe39adcfb5bb584c4e264c0c2381814e64aaf3df8fbb07
MD5 01e3a2a74b67180f49ce2b7b9e9a30d8
BLAKE2b-256 dbe6c40f4d890d0bbccd9b25d525d80bd45f8296fa94979bf89215ef0501824f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page