Skip to main content

A simple and customizable logging library for Python.

Project description

LogAssist

A simple and customizable logging library for Python.

Installation

pip install LogAssist

Features

  • Easy to use and configure
  • Supports multiple log levels (debug, info, warning, error)
  • Outputs log messages to both console and file
  • Allows for log file removal on initialization
  • Provides datetime formatting for log messages

Usage

  1. Import the Logger class:
import LogAssist.log as Logger
  1. Initialize the logger with your desired settings:
Logger.logger_init(config=my_config_dictionary)
# or
Logger.logger_init()
  1. Use the logger in your code:
Logger.verbose('MyTag', 'This is a verbose message')
Logger.debug('MyTag', 'This is a debug message')
Logger.info('MyTag', 'This is an info message')
Logger.warn('MyTag', 'This is a warning message')
Logger.error('MyTag', 'This is an error message')
Logger.exception('MyTag', 'This is a exception message')

Configuration

You can configure the logger using a JSON configuration. Below is an example of a configuration and explanations for each field.

Example Usage:

{
    "base": {
        "name": "MyLogger",
        "level": "debug"
    },
    "console": {
        "level": "debug",
        "format": "%(asctime)s[%(levelname)s]%(message)s"
    },
    "file_timed": {
        "level": "info",
        "format": "%(asctime)s[%(levelname)s]%(message)s",
        "file_name": "default.log",
        "when": "midnight",
        "interval": 1,
        "backup_count": 30
    }
}

Configuration Fields

base

  • name: The identifier for the logger. Default is 'MyLogger'.
  • level: The minimum log level to set (debug, info, warn, error, exception). Default is 'debug'.

console

  • level: The minimum log level for console output (debug, info, warn, error, exception). Default is 'debug'.
  • format: Defines the log message format for console output. Default is %(asctime)s[%(levelname)s]%(message)s.

file_timed

  • level: The minimum log level for file output (debug, info, warn, error, exception). Default is 'info'.
  • format: Defines the log message format for file output. Default is %(asctime)s[%(levelname)s]%(message)s.
  • file_name: The file name to use for logging. Default is 'default.log'.
  • when: The time interval for rotating the log file (e.g., 'midnight'). Default is 'midnight'.
  • interval: Defines how often the log file is rotated. Default is 1.
  • backup_count: Specifies the number of backup files to keep. Default is 30.

Use this JSON configuration to initialize your logger with the desired settings.

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

logassist-1.1.4.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

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

logassist-1.1.4-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file logassist-1.1.4.tar.gz.

File metadata

  • Download URL: logassist-1.1.4.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for logassist-1.1.4.tar.gz
Algorithm Hash digest
SHA256 64b2e2ed94da2451e2aa4030f071369e56e21e9e9c7f16c6ae49e01c762429e4
MD5 56603bcb9f4af63f596e7f1d151feec8
BLAKE2b-256 1b3cde90fcda0d021a3cbf22389863754ef3210a51dbc4471654e28d0a10e2ec

See more details on using hashes here.

File details

Details for the file logassist-1.1.4-py3-none-any.whl.

File metadata

  • Download URL: logassist-1.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for logassist-1.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 866ba6778668e2c401925285c932941785e5bf64251b591c943915301723d01c
MD5 8efcdf460650c3ad3a54ef99599a1d97
BLAKE2b-256 6a744c6acdadea816dcb1b95d1e92c9d1959ca2bdc0208f7fc6b87b4f68b081b

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