Skip to main content

No project description provided

Project description

tiny-logging

Install

pip install tinylogging

Usage

Create a Logger

from tinylogging import Logger, Level

logger = Logger(name="my_logger", level=Level.DEBUG)

Log messages

logger.info("This is an info message.")
logger.error("This is an error message.")
logger.debug("This is a debug message.")

Add File Logging

from tinylogging import FileHandler

file_handler = FileHandler(file_name="app.log", level=Level.WARNING)
logger.handlers.add(file_handler)

logger.warning("This warning will be logged to both console and file.")

Custom Formatting

from tinylogging import Formatter

formatter = Formatter(template="{time} - {name} - {level} - {message}", colorize=False)
logger = Logger(name="custom_logger", formatter=formatter)
logger.info("This log message uses a custom format.")

Disable Logging

logger.disable()
logger.info("This message will not be logged.")
logger.enable()

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

tinylogging-2.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

tinylogging-2.1.0-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file tinylogging-2.1.0.tar.gz.

File metadata

  • Download URL: tinylogging-2.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-45-generic

File hashes

Hashes for tinylogging-2.1.0.tar.gz
Algorithm Hash digest
SHA256 91abb7cee90947c85e4d8282c8b5c6bc95d1af7a010f89ec226abf0b1653c4b8
MD5 ee995513f56b5ebd5fb00245937140f7
BLAKE2b-256 7f20d260dc57196964a3d31189a16c5feee0ec530f7414486db66b427d00e3b9

See more details on using hashes here.

File details

Details for the file tinylogging-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: tinylogging-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-45-generic

File hashes

Hashes for tinylogging-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e4bff086d7405876c48f954cc2a01f459348db4739173354ab1ed5ab0285356
MD5 1848aacbfb5cbd09c5b178b444ce173a
BLAKE2b-256 1e214ce82405ee5eba0969e7d317a92c61bc7bd37af9233aa15b04f1b27b4093

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