Skip to main content

loggerpy

The simplest Python logger for everyday tasks.

Table of Contents

Installation

The easiest way to install is throw pip.

pip install loggerpy

Instructions

In order to use this simple logger, many examples are provided inside examples directory

logging

Configuration

The main classes of the loggerpy package are Logger and Level.

from loggerpy import Logger, Level

The Logger class is a Singleton, so you can recall the __init__ method through Logger() and the same instance will always be returned.

logger = Logger()

The possible customization of the logger instance are:

  • name: the name of all loggers
  • folder: the path of saving log if you want to save them
  • print_level: the minimum level of printing
  • save_level: the minimum level of saving, they can be different

In order to simplify the customization of printing and saving level it is provided a class that contained the 6 possible levels of logging. Importing Level from loggerpy, they can be used eg Level.DEBUG or Level.WARNING

  • Level.NO_LOGGER
  • Level.DEBUG
  • Level.INFO
  • Level.WARNING
  • Level.ERROR
  • Level.CRITICAL

The path can be set as absolute or relative. If the path is an absolute path it is used directly, otherwise it put after the project path. The default value is the project path

 E.g.
 Relative path
 -------------
 >>> logger.folder = 'relative_path'
 In this case the used path is:
 > /path/to/the/project/relative_path

 Absolute path
 -------------
 >>> logger.folder = 'absolute_path'
 It is setted as global path
 > /absolute_path/

Configuration example

Logger

Now, it's time to create your first logger.

from loggerpy import Logger

logger = Logger()
logger.name = "First logger"

First logger example

Customization

The parameters of the Logger class can be set all in one time.

logger.configure(name="Name", log_folder="path/to/log/folder", print_level=Level.DEBUG, save_level=LEVEL.WARNING)

An example

Versions

stable version

  • 1.0 :

    • first release
  • 1.1 :

    • rewritten the input path of saving log in configure() and get_logger()
    • configuration works properly for all file of your project
  • 2.0 :

    • Logger is now a Singleton
    • Level is an enum

NextFeatures

  • custom format for timestamp
  • custom format for all log
  • custom color for each level

License

This project is under the GPL-3.0 license - see the LICENSE.md file for more details

Metadata

Release files for loggerpy 2.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loggerpy 2.1.1
File Size Uploaded Provenance Actions
loggerpy-2.1.1.tar.gz 6.1 kB Without provenance Details for loggerpy-2.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for loggerpy 2.1.1
File Interpreter ABI Platform Actions
loggerpy-2.1.1-py3-none-any.whl Python 3 none any Details for loggerpy-2.1.1-py3-none-any.whl

Total release size: 24.9 kB

Release files / loggerpy-2.1.1.tar.gz

Download URL loggerpy-2.1.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e149accfb5fd044997f036a7239ee958a24e4a19497824863a4bbbea47ff7a95
BLAKE2b-256 checksum
How to use checksums
429c65c89d98ec30f432c8dd2638a509b2510f945f6d0873b43f8ea7bf04cd70
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.0

Release files / loggerpy-2.1.1-py3-none-any.whl

Download URL loggerpy-2.1.1-py3-none-any.whl
Size 18.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b68472dc1d297ea705ee4d1a2768fbd1574a4c2ede16037e7cd0c4c7406de382
BLAKE2b-256 checksum
How to use checksums
4256a396d51779f9137d4d2615915c3b32a7db2efdf08ce5ac01037e05034a6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.55.0 CPython/3.9.0

Security for loggerpy 2.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page