Logger used by Server Monitoring Discord Bot and all extentions made by me
Project description
Server monitoring Discord bot Logger
Possible log formats:
- [COUNTER] [LEVEL]: DATA{END}
- [COUNTER] [FILE_NAME->METHOD_1->...->CALLER]: DATA{END}
- [COUNTER] [METHOD_1->...->CALLER]: DATA{END}
Available log levels:
- DEBUG
- INFO
- WARNING
- ERROR
- HEADER
Options:
Variable name | Description | Default value |
---|---|---|
log_file | The name of the log file | - |
log_folder | The path of the folder to save the log file | Current Directory |
clear | Clears the log file every time it's initialized | False |
level | Sets the minimum level for the logger to show | INFO |
log_to_console | Sets to log to console too | False |
storage_life_extender_mode | Limits the writes to the file by caching the data | False |
max_logfile_size | Limits the size of one log file in MB | -1 (No limit) |
max_logfile_lifetime | Limits the time a log file can live (except the currently used one) | -1 (No limit) |
__print | Callable for consol logging | stdout.write |
use_caller_name | Use the caller's name in consol logging instead of the level | False |
use_file_names | Use the file name whe using the caller name or not | True |
level_only_valid_for_console | Sets to log the unwanted levels but don't display them in console | False |
Additional info
The consol logging uses colors for the different levels to be more recognisable at a glance. It also supports headers, after which it indents the logs to add some structure.
DEBUG
#E600E5
INFO
#0BFF00
WARNING
#FEFF00
ERROR
#FF0000
HEADER
#4182B7
Available methods
get_buffer()
Return sthe buffer's content in a list, if the logger is set to use buffers.
flush_buffer()
Forces a writes of the buffer to the log file.
set_level(level)
Sets the loggers leve to be used from this point onwards.
set_folder(folder)
Sets the loggers folder to be used from thi point. It also runs the basic validation on the inputed path.
log(level, data, counter = str(datetime.now()), end = "\n")
Creates a log entry with the given level.
header(data, counter = str(datetime.now()), end = "\n")
Creates a HEADER level log entry.
debug(data, counter = str(datetime.now()), end = "\n")
Creates a DEBUG level log entry.
warning(data, counter = str(datetime.now()), end = "\n")
Creates a WARNING level log entry.
info(data, counter = str(datetime.now()), end = "\n")
Creates a INFO level log entry.
error(data, counter = str(datetime.now()), end = "\n")
Creates a ERROR level log entry.
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
smdb_logger-0.2.4.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for smdb_logger-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2eb3f77dcd509139d15c7510a09c64f9e18e60e23d7e005c9f8bfe50673737d3 |
|
MD5 | de8d68863f1b785cd3b2242b49052c80 |
|
BLAKE2b-256 | 66761d36d3b1eba3087452123485ab7d6e6a163cb0f9daecd65e8679c8a2a700 |