loggerpy 2.1.1

Creator: railscoder56

Last updated:

Add to Cart

Description:

loggerpy 2.1.1

loggerpy
The simplest Python logger for everyday tasks.





Table of Contents

Installation
Instructions

Configuration
Logger
Customization
Logger Recovery


Version
Next features
License


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

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

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.