Logger used by Server Monitoring Discord Bot and all extentions made by me
Project description
Server monitoring Discord Bot Logger
This is a logger used by the Server Monitoring Discord Bot and every module created for it by me.
Possible log formats:
- [COUNTER] [LEVEL]: DATA{END}
- [COUNTER] [FILE_NAME->METHOD_1->...->CALLER]: DATA{END}
- [COUNTER] [METHOD_1->...->CALLER]: DATA{END}
Available log levels:
- TRACE
- DEBUG
- INFO
- WARNING
- ERROR
- HEADER
Options:
| Variable name | Description | Default value |
|---|---|---|
| log_file_name | The name of the log file | None |
| 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 | True |
| 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 |
| __error | Callable for consol error logging. None sets to be __print | stderr.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 |
| use_log_name | Use the log file name to differenciate between multiple loggers on console | False |
| level_only_valid_for_console | Sets to log the unwanted levels but don't display them in console | False |
| log_disabled | Disables logging to everywhere, and disables warning about silent logging | 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.
TRACE
#00E6E5
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.
trace(data, counter = str(datetime.now()), end = "\n")
Creates a TRACE 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
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 smdb_logger-0.7.0.tar.gz.
File metadata
- Download URL: smdb_logger-0.7.0.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c4dfc4a44239041666db52865ba9711b3109fdf5c6f1223e1575898ede22637
|
|
| MD5 |
e288e2ed5e7e89b3e09a7d8d4e59ea66
|
|
| BLAKE2b-256 |
37a8d63f297a95a2f5ec1d734fc0c771a35d6e148babe1ab4c1ab8b80f9e9fa0
|
File details
Details for the file smdb_logger-0.7.0-py3-none-any.whl.
File metadata
- Download URL: smdb_logger-0.7.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
561cf50aa4ab05c28974da984464584dc7161c734d78f05a8e5a95bc9cd9e697
|
|
| MD5 |
362f33606bb7f0a9bd6bdfef1014b6f4
|
|
| BLAKE2b-256 |
9c8f7fa35e33e556a14aaf22f4cc39e6fb9996de622716580e260faf74a78b9a
|