Siple logging for porject with multiple modules
Project description
log_wizard
Installation
To get started with Log Wizard, you can easily install it using pip
pip install log-wizard
usage
from log_wizard import DefaultConfig, log
# initilize DefaultConfig if need
# You can do it onece, before first call of log
# Also look at params for DefaultConfig
# info_file_postfix takes all log msgs except .debug
# debug_file_postfixh takes all log msgs
DefaultConfig(info_file_postfix = 'info', debug_file_postfixh = 'debug')
# I can add a handler for your own function
# DefaultConfig().set_ui_log_func(print)
# now in any module of your project you can use this log
log = log()
# write log info
log.info("info") # 20.09.2023 06:10:35 - INFO - info
log.error("error") # 20.09.2023 06:10:35 - ERROR - error
log,critical("critical") # 20.09.2023 06:10:35 - CTITICAL - critical
proc_id = '12345'
with log.insert_proc_id(proc_id):
#20.09.2023 06:10:35 - INFO - 12345 - here should be proc id
log.info("here should be proc id")
with log.insert_func_name():
log.info("here also should be proc id and a func name, where log was called")
Configuration
You can configure Log Wizard by modifying the DefaultConfig class.
Features
Insert process IDs into log messages Insert function names into log messages Supports different log levels (info, error, debug, critical, etc.)
License
This project is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.
Contact
For any questions or feedback, feel free to contact me at ruslan.izhakovskij@gmail.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file log_wizard-1.2.0.tar.gz.
File metadata
- Download URL: log_wizard-1.2.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3c30d01161cc004f6d9be38fb653b38bf97d519c4e5c3ca13fdc2edc98fe6696
|
|
| MD5 |
3db8fcfa31f4ad523bbb0e2ec377255a
|
|
| BLAKE2b-256 |
225bbe858d52e85b2d40bc612d05876179e6709f7f2fd932a07eeb27c987f96d
|
File details
Details for the file log_wizard-1.2.0-py3-none-any.whl.
File metadata
- Download URL: log_wizard-1.2.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f21e95f2d40404768fca98c17ed5e5d7b6eac1174fe2bcf5c7110db00d11f80
|
|
| MD5 |
5f9c03f2464c30ce51dd488cf20feff3
|
|
| BLAKE2b-256 |
9e7401317fcba13efbb55561c001f883db099a6a68b4c3891f511e278884b01e
|