This is a multilogger for LogTail, File and terminal print
Project description
KiwiLogger A simple Python logger class that logs messages to Logtail, a local file, and/or the terminal. Easily configurable and customizable.
Features Log messages to Logtail (an online logging service) Log messages to a local file Log messages to the terminal (stdout) Specify the logging level (e.g., INFO, ERROR, CRITICAL) Add structured logging (extra data) to log messages
Installation Before using KiwiLogger, you need to install the multikiwilogger library:
bash Copy code pip install multikiwilogger
Usage python
Copy code from multikiwilogger import KiwiLogger
Initialize the logger
mlog = KiwiLogger(log_online=True, log_local=True, log_terminal=True)
Log a simple message
mlog('This is an INFO message.') # Defaults to INFO level
Log a message with a specific level
mlog('Something bad happened.', level='ERROR')
Log a message with structured logging (extra data)
mlog('Log message with structured logging.', level='INFO', extra={ 'item': "Orange Soda", 'price': 100.00 })
Configuration Initialize the KiwiLogger with the following optional parameters:
name (default: name): The name of the logger. level (default: logging.INFO): The minimum log level for messages. log_online (default: True): Log messages to Logtail. log_local (default: False): Log messages to a local file. log_terminal (default: True): Log messages to the terminal (stdout).
Environment Variables KiwiLogger relies on the LOGTAIL_SOURCE_TOKEN environment variable to send logs to Logtail. Set this variable in your environment or add it to a .env file:
makefile Copy code LOGTAIL_SOURCE_TOKEN=your_logtail_source_token_here Replace your_logtail_source_token_here with the actual source token provided by Logtail.
License This project is licensed under the MIT License.
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
Built Distribution
File details
Details for the file multikiwilogger-1.1.0.tar.gz
.
File metadata
- Download URL: multikiwilogger-1.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e1ebe093696284354b20d0bfe896ba71efa0b0779fa6389ea5f8aec304d1a81 |
|
MD5 | 9a687af9c3453ade2aa4b96eff4c4304 |
|
BLAKE2b-256 | 865c7126725e0a007590a91c07382edc6a8fcf44f7db6e1b72232c535899f023 |
File details
Details for the file multikiwilogger-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: multikiwilogger-1.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 28aa0bd54625e443142b2aa859e65ecb2820fab581294aa0659da2f11c56adcf |
|
MD5 | 49266bebe135b820b2f3c73830fe65b5 |
|
BLAKE2b-256 | 24ee9bab779a2213b186ce397d8442e55268927b1d6a6376cd85fdf79e79fcda |