19
Easiest Multi-Modular Python Logging
Installation
You need to download 2 files from the GitHub repository attached below and place it in your current working folder.
Files : Logger.py with the config logging.conf
Link : Github Repository
Usage
Import the Easy-Logger Wrapper into your Script/Module
import Logger
Then initialize it in the main indent
logger = Logger.Logger("Main Program")
And that’s all. Now you can log your heart out throughout your module using :
logger.debug("Nice My Debug Log Message")
logger.info("Ok My Info Log Message")
logger.warning("Hmm My Warning Log Message")
logger.error("Oops My Error Log Message")
logger.critical("Eeehhh My Critical Log Message")
Advanced Usage
There are two level of details in the Easy-Logger at the moment
- root
- brief The level can be changed easily when initializing the module by using the following command
logger = Logger.Logger("Main Program",'brief')
logger = Logger.Logger("Main Program",'root')
- Example Code
- More level of details handlers in the Easy-Logger
- Details about modifying the configuration file
- Logs rotation details
- Network Logging
- More Log Formats First of many stories & tutorials to come.. Still getting familiar with the medium and its interface though 😆. Hopefully these will prove worthwhile to the community.
19