Skip to main content

A simple logging utility for Python applications

Project description

Certainly! Below is a sample README.md file tailored for presenting the LoggerUtility class on GitHub and PyPI:

# LoggerUtility

`LoggerUtility` is a Python class that simplifies logging setup across your Python applications. It provides a streamlined way to configure loggers with custom formats, different logging levels, and optional file output. Whether you're debugging during development or monitoring in production, `LoggerUtility` can help you keep clear and concise logs.

## Features

- Easy logger configuration with just a few lines of code.
- Customizable log message format.
- Optional date formatting in log messages.
- Support for logging to console or files.
- Convenience methods for various logging levels (`debug`, `info`, `warning`, `error`, `critical`).

## Installation

You can simply copy the `LoggerUtility` class into your project, or if you have it packaged, you can install it via `pip` (assuming you have it available on PyPI):

```bash
pip install cd-logging

Usage

Here is a quick example of how to use LoggerUtility:

from logger_utility import LoggerUtility

# Initialize the logger
logger_util = LoggerUtility(__name__, level=logging.INFO)

# Log some messages
logger_util.info("Application is starting...")
logger_util.warning("An optional warning message.")
logger_util.error("An error occurred.")

# Log a critical message with exception traceback
try:
    raise ValueError("An example exception.")
except Exception:
    logger_util.critical("A critical error occurred.", exc_info=True)

Configuration

When initializing the LoggerUtility, you can customize the following:

  • name: The logger's name, typically set to __name__ to reflect the module's name.
  • level: The threshold for the logging messages (e.g., logging.DEBUG, logging.INFO).
  • log_format: Custom format for the log messages.
  • date_format: Custom date format for the log messages.
  • filename: If set, logs will be directed to the specified file.

Documentation

For more details on how to use and configure LoggerUtility, please refer to the inline documentation within the class itself. Each method and initializer parameter is thoroughly documented with docstrings.

More documentation at: Code Docta

Contributing

We welcome contributions from the community! If you'd like to contribute, feel free to fork the repository, make your changes, and submit a pull request.

License

LoggerUtility is licensed under the MIT License. See the LICENSE file for more details.

Contact

If you have any questions or feedback, please open an issue in the GitHub repository, and we will get back to you as soon as possible.


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

cd_logging-0.0.3.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

cd_logging-0.0.3-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file cd_logging-0.0.3.tar.gz.

File metadata

  • Download URL: cd_logging-0.0.3.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cd_logging-0.0.3.tar.gz
Algorithm Hash digest
SHA256 bf6c0476e1451c347e15954086b31fd2ef2e9d3849ebeb76ffc933b4430a1de7
MD5 bf16bb2b8e38bbaf7d506c5ee928c2d7
BLAKE2b-256 3ec3d5bcb21f84485d62da6eeaa41d34cc07e36fd41f6eef79be0e12c299c715

See more details on using hashes here.

File details

Details for the file cd_logging-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: cd_logging-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for cd_logging-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc994fdd6a0bca1fa1b20a4645f2c979043c5cb32a2a129b6985d7d2e677269
MD5 2f2ed98b32d51181e1ee458683760c3b
BLAKE2b-256 53c117f56c61986abea705ff245c63f8f988899a925c80774cc89324515c8f34

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