Skip to main content

A very simple logger.

Project description

Kogger

This is a very simple logger.

Install

pip install kogger
# or pip install git+https://github.com/zengbocheng/kogger.git

Usage

There are two basic methods to use it.

Create a Logger Object

from kogger import Logger

logger = Logger('__main__')
# logger = Logger('__main__', stream='out.log')
# logger = Logger()

logger.info('Hello, world!')
logger.warning('Hello, world!')
logger.error('Hello, world!')

The output of is

[2023-04-11 23:26:38] [__MAIN__] [INFO] Hello, world!
[2023-04-11 23:26:38] [__MAIN__] [WARNING] Hello, world!
[2023-04-11 23:26:38] [__MAIN__] [ERROR] Hello, world!

Use the Default Logger of Package

import kogger

# kogger.set_name('__main__')
# kogger.set_file('out.log')
kogger.info('Hello, world!')

Warning

If you use the logger in multiple processes to output logs synchronously into the same file, the behaviors are undefined. You have better to find another package supporting multiple processes.

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

kogger-0.1.4.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

kogger-0.1.4-py3-none-any.whl (3.4 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