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
- Import the Logger class:
from LogAssist.log import Logger
- Initialize the logger with your desired settings:
Logger.init(log_level='verbose', dir_name='./log', file_name='my_log.log', prev_log_remove=True, out_console=True, out_file=True)
# or
Logger.init()
- 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.warning('MyTag', 'This is a warning message')
Logger.error('MyTag', 'This is an error message', exc_info=sys.exc_info())
Configuration
You can configure the logger using the init method or by passing a dictionary of logger information to the logger_init method. The available options are:
- log_level: The log level to set (verbose, debug, info, warning, or error). Default is 'verbose'.
- dir_name: The directory name to use for log files. Default is './log'.
- file_name: The file name to use for logging. Default is None, which will create a file named "Logger.log".
- prev_log_remove: Whether to remove the existing log file on initialization. Default is False.
- out_console: Whether to output log messages to the console. Default is True.
- out_file: Whether to output log messages to a file. Default is True.
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
LogAssist-1.1.0.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for LogAssist-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a923ac5e6b7d9a37a940d023372f17a3a1b0e69d59a5ecb9e0aa0ea78f100a1c |
|
MD5 | 44b14eea5bbbc9f6bcdb2a4778ea2b92 |
|
BLAKE2b-256 | 66a1be3e31d5677d45c104cb365441cb4e83dca0c4560be1d2bd4f8f69386a05 |