Skip to main content

Easy logging

Project description

kellog

Extremely easy to use python print() replacement with coloured output and status icons.

Installation

$ pip install kellog

Requires python version 3.7 or above.

Usage

It is very very simple to start using this right away:

from kellog import debug, info, warning, error, critical

debug("Debug message")
info(f"Five plus six is {5 + 6}")
warning("f-strings are better than", "comma-separated", "arguments")
error("Exception")
critical("DEFCON 1")

image

kellog wraps the built-in logging library, so it can be controlled in the same ways. For instance, logging to file and configuring the output format.

class Kellog(
	path: Path | None,
	name: str,
	prefixes: dict[str, str] | None,
	append: bool,
)

Parameters
----------
path, optional
  Output file, by default None
name, optional
  Reset the logger name to this, by default "kellog"
prefixes, optional
  Set the log message prefixes (does not automatically add separating whitespace), by default None.
  The dictionary keys to set are "debug", "info", "warning", "error", "critical".
  Setting to None will use the default unicode prefixes, from codicons:      .
append, optional
  If False, delete the contents of `path` first, by default True

Tests

Install this package with:

pip install -e .[dev]

Then run the tests:

make tests

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

kellog-1.0.0.tar.gz (43.9 kB view hashes)

Uploaded Source

Built Distribution

kellog-1.0.0-py3-none-any.whl (31.3 kB view hashes)

Uploaded Python 3

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