Skip to main content

A simple logger library for Python.

Project description

Simple Logger

Simple Logger is a simple and customizable logging library for Python. It provides various logging levels with colored output for better visibility in the console and logs messages to a specified file.

Features

  • Multiple Log Levels: Log messages with different severity levels, including INFO, WARNING, ERROR, DEBUG, and CRITICAL.
  • Custom Prefix: Easily customize the prefix for all log messages.
  • Colored Output: Get colorful console output for better readability.
  • File Logging: Automatically logs messages to a file with a timestamp.
  • Graceful Error Handling: Stops execution on critical errors with a clear message.

Installation

You can install the library using pip:

pip install fluent-simple-logger

Usage

Here's a quick example of how to use Simple Logger:

from simple_logger.logger import Logger

# Create a logger instance
logger = Logger()

# Log messages
logger.info("This is an informational message.")
logger.warning("This is a warning message.")
logger.error("This is an error message.")
logger.debug("This is a debug message.")
logger.critical("This is a critical error message.")

Custom Prefix

You can customize the prefix used in log messages like this:

logger.set_prefix("[Custom Prefix]")
logger.info("This is an info message with a custom prefix.")

Logging to a Specific File

You can specify a different log file when creating the logger instance:

logger = Logger(log_file='custom_log.txt')
logger.info("This message will be logged to custom_log.txt.")

Running Tests

To run the tests for the Simple Logger library, you can use the following command:

python -m unittest discover tests

Contributing

Contributions are welcome! If you have suggestions for improvements or want to report a bug, please create an issue or submit a pull request.

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

fluent_simple_logger-0.1.10.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fluent_simple_logger-0.1.10-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file fluent_simple_logger-0.1.10.tar.gz.

File metadata

  • Download URL: fluent_simple_logger-0.1.10.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for fluent_simple_logger-0.1.10.tar.gz
Algorithm Hash digest
SHA256 d96e35b76e796735556df6643843e2b4718bfa549e0ffb62df6024b75aeb52b8
MD5 2049e700e0125e8de6227aac9c419acc
BLAKE2b-256 19c3f9d22d806c47ee2e61a532126e074529d8613a380d1b58c726ade225cfc0

See more details on using hashes here.

File details

Details for the file fluent_simple_logger-0.1.10-py3-none-any.whl.

File metadata

File hashes

Hashes for fluent_simple_logger-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 d16cbc44cb8e5d577fb9bf4a6e83c10cab0cc4116c2bd1f078e3626875736246
MD5 38e06726a06bacdf75a37c819bf6c118
BLAKE2b-256 45d150e36f40451092c4337fd8e6b8460be6b546133eb9ade019b6070832956d

See more details on using hashes here.

Supported by

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