Skip to main content

Logging

Project description

Description:

Constants: LOG_LEVELS: A dictionary mapping log level names to their corresponding numeric values. These values are used to determine the severity of log messages.LOG_COLORS: A dictionary mapping log levels to ANSI escape codes for colored output in the console.

Logger Class: Logger: A class for handling logging. It has methods like log, debug, info, warning, error, and critical for different log levels. Initialization Method (init): The constructor (init) initializes a Logger instance with a specified name and log level (default is 'INFO').

Log Method (log): The log method is a general method used by other log level methods to print log messages. It checks the log level and prints the message with a timestamp and color. Log Level Methods (debug, info, warning, error, critical): These methods are shortcuts for logging messages at specific log levels. They call the log method with the corresponding log level.

In summary, this code defines a simple logging system with different log levels and colored output for different levels. The Logger class can be instantiated with a name and allows logging messages at various severity levels.

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

logmag-1.1.tar.gz (2.1 kB view details)

Uploaded Source

File details

Details for the file logmag-1.1.tar.gz.

File metadata

  • Download URL: logmag-1.1.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.5

File hashes

Hashes for logmag-1.1.tar.gz
Algorithm Hash digest
SHA256 178c83a1698bf2640a32c49f6a1a1e5a6683099f090c52a3754b328cae885be6
MD5 e69423a02f84caec267c96edc19804df
BLAKE2b-256 2061769e884707113c12e2ce7af570e0c2ef728379aa1720c1933051799536a8

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