Hassle free ready to use out of the box Python3 logger.
Project description
How to install
pip install AshLogger
Documentation
from AshLogger import AshLogger
logger_obj = AshLogger(
file_name='logger_file_name.log' # If `file_name` is not given, it will set logger file name as `AshLogger.log`
, file_location=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logs') # If log file path not given, it will create a log/ dir where the calling python file is located.
, max_bytes=20000 # default: 1000000
, max_backups=3 # default: 1
)
logger = logger_obj.setup_logger()
# * Testing logger
logger.info(f'{1} info log')
logger.debug('%s debug log', 2)
logger.warning('{0} warning log'.format(3))
logger.error('4 error log')
# ! USE ANY ONE TYPE OF LOGGER IN A SINGLE FILE, EITHER ABOVE OR BELOW.
# No need to make object for the class AshLogger, as @classmethod is used as alternative constructor.
basic_logger = AshLogger.setup_basic_logger(
file_name='basic_logger_file_name.log' # If `file_name` is not given, it will set logger file name as `AshBasicLogger.log`.
, file_location=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logs') # If log file path not given, it will create a log/ dir where the calling python file is located.
)
# * Testing basic logger
basic_logger.info(f'{1} info log')
basic_logger.debug('%s debug log', 2)
basic_logger.warning('{0} warning log'.format(3))
basic_logger.error('4 error log')
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
AshLogger-0.2.tar.gz
(4.1 kB
view details)
File details
Details for the file AshLogger-0.2.tar.gz.
File metadata
- Download URL: AshLogger-0.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cba05b8978d286ac4ef6a528c2d441bc90022bc0e353c3376304191fcd758b8
|
|
| MD5 |
1773f63d3af6a14067eed63c4ed33935
|
|
| BLAKE2b-256 |
a6dda27671a94ba017b64c9c4939737aef9dababb2e70ac0a35b4ba1b6b6c8e4
|