Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

multikiwilogger-1.0.8.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

multikiwilogger-1.0.8-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file multikiwilogger-1.0.8.tar.gz.

File metadata

  • Download URL: multikiwilogger-1.0.8.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for multikiwilogger-1.0.8.tar.gz
Algorithm Hash digest
SHA256 32d001391b1b6f9934c1a1e0aa76bdb7101b27295ae1e134341a3e69600f3d10
MD5 556ba6688cb0bd1a94980094be8c9189
BLAKE2b-256 97a16506533cb7b1295ca51acdf77b1530edd73d942082048eda35808af258f9

See more details on using hashes here.

File details

Details for the file multikiwilogger-1.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for multikiwilogger-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 ba16609a67a1b956c4300a0ce1224d61d2042f8fd769218cb5014ce7a834ad31
MD5 9f077a2aa1b12db2fdc117173ae0a47e
BLAKE2b-256 1495d92f363f2a2d09cf15b9826b892c3446f3c45d5ee64c9ad2ca5a46ea900d

See more details on using hashes here.

Supported by

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