Utils Module Documentation¶
log.py¶
Helps user to create and configure their logger object
This module can be used to improve observability in log messages by providing and easy way to create and retrieve logger objects with a given configuration.
log_config(logger_name=__file__, logger_level=logging.INFO, logger_date_format='%Y-%m-%d %H:%M:%S')
¶
Logger object configuration.
This function can be used in any Python application in order to improve log proccesses and enhance software observability. It uses the logging built-in Python package to retrieve users a basic logger object with a given configuration.
Examples:
# Getting and configuring the logger object
logger = log_config(logger)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
logger_name |
str
|
A name for the logger object |
__file__
|
logger_level |
int
|
The type of the logger object |
logging.INFO
|
logger_date_format |
str
|
Message format of the logger object |
'%Y-%m-%d %H:%M:%S'
|
Returns:
Type | Description |
---|---|
logging.Logger
|
A preconfigured logger object |
Source code in sparksnake/utils/log.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
|