Skip to main content

Loggingpython is a Python package that provides a simple and extensible way to integrate logging into your applications. The package starts with a simple logger and can be extended with additional functions to meet the requirements of your application.

Project description

loggingpython

loggingpython is a Python package that provides a simple and extensible way to integrate logging into your applications. The package starts with a basic logger and can be extended with additional functions to meet the requirements of your application.


Installation

With pip

For a simple installation via pip, run the following command:

pip install loggingpython

With GitHub

To install the latest development of loggingpython directly from the GitHub repository, follow these steps:

  1. Clone the repository:
git clone https://github.com/loggingpython-Community/loggingpython.git
  1. Change into the cloned directory:
cd loggingpython
  1. Install the package:
pip install .

Simple Example

In this section, we show how to configure and use a basic logger with loggingpython. First, we import the package and create a logger:

import loggingpython as lp

# Create a basic logger
logger = lp.getBasicLogger()

This creates a logger with a Filehandler and a Consolehandler, the Consolehandler has colors at message.

This creat a logger without handlers.

import loggingpython as lp

# Create a logger
logger = lp.getLogger()

# Creat a FileHandler
filehandler = lp.FileHandler(logger.name)
logger.addHandler(filehandler)

# Creat a Consolehandler
consolehandler = lp.ConsoleHandler()
logger.addHandler(consolehandler)

# Creat a JSONhandler
jsonhandler = lp.JSONHandler()
logger.addHandler(jsonhandler)

Now, we can use the logger to generate various types of log messages:

python

# Logging messages at different levels
logger.debug("This is a debug message.")
logger.info("This is an info message.")
logger.warning("This is a warning.")
logger.error("This is an error.")
logger.critical("This is a critical error.")

#Log message with an exception
try:
    1 / 0 
except ZeroDivisionError as e:
    logger.error("An exception occurred: %s", e)

The file handler saves the logs in the logs/file.log directory.

This example shows how to configure and use a basic logger to generate various types of log messages.


We welcome your contributions to the development of loggingpython. If you have feedback, suggestions or would like to contribute to the development, please visit our GitHub repository for more information. You can also find more details in our wiki or in the folder Docs. For more detailed information, please also visit our package page on PyPi.


License

loggingpython 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

loggingpython-1.1.2.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

loggingpython-1.1.2-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file loggingpython-1.1.2.tar.gz.

File metadata

  • Download URL: loggingpython-1.1.2.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for loggingpython-1.1.2.tar.gz
Algorithm Hash digest
SHA256 75e52de767405a9f90e1da79840a6f5379a5fa7bb589595553d6a73b30694bbe
MD5 de26ef83d6491eb5dde8a91ddea0480e
BLAKE2b-256 845a235ea7c042eab9132cc2738c3905c3b20cc53a25468324910e44fed91b9e

See more details on using hashes here.

File details

Details for the file loggingpython-1.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for loggingpython-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 583067d4711e0ec3b00961094ddcccebad864712a33f2f3cbe137fb55855c29c
MD5 65268be53e3756e155af4d5d5cb1d042
BLAKE2b-256 99ae74d7c30951bb9b189d91bdfa836dade25919c1ac9b796fd5bb1b9b6ba375

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