slofop
The hell is this name?
The name 'slofop' stands for 'Simple logger for Python'.
Showcase
After running the example.py file, ...
- ...the terminal output is
- ...the content of 'test.log' is
DEBUG MainThread 25.10.2022 17:00:49 CEST: {
"__name__": "__main__",
"__doc__": null,
"__package__": null,
"__loader__": "<_frozen_importlib_external.SourceFileLoader object at 0x7fab7107d510>",
"__spec__": null,
"__annotations__": {},
"__builtins__": "<module 'builtins' (built-in)>",
"__file__": "/run/media/paddecraft/4EE0F299E0F2870D/Dev/PythonScripting/slofop/example.py",
"__cached__": null,
"filesystem_handlers": "<module 'slofop.filesystem_handlers' from '/run/media/paddecraft/4EE0F299E0F2870D/Dev/PythonScripting/slofop/slofop/filesystem_handlers.py'>",
"util": "<module 'slofop.util' from '/run/media/paddecraft/4EE0F299E0F2870D/Dev/PythonScripting/slofop/slofop/util.py'>",
"slofop": "<module 'slofop.slofop' from '/run/media/paddecraft/4EE0F299E0F2870D/Dev/PythonScripting/slofop/slofop/slofop.py'>",
"Logger": "<class 'slofop.slofop.Logger'>",
"LoggingLevel": "<enum 'LoggingLevel'>",
"os": "<module 'os' from '/usr/lib/python3.10/os.py'>",
"time": "<module 'time' (built-in)>",
"atexit": "<module 'atexit' (built-in)>",
"pathlib": "<module 'pathlib' from '/usr/lib/python3.10/pathlib.py'>",
"threading": "<module 'threading' from '/usr/lib/python3.10/threading.py'>",
"NoneType": "<class 'NoneType'>",
"BaseFilesystemHandler": "<class 'slofop.filesystem_handlers.BaseFilesystemHandler'>",
"TimedFilesystemHandler": "<class 'slofop.filesystem_handlers.TimedFilesystemHandler'>",
"log": "Logger {colors: {DEBUG: [#c7dcff]#c7dcff[/#c7dcff], INFO: [#3caae6]#3caae6[/#3caae6], WARNING: [#e0c528]#e0c528[/#e0c528], ERROR: [#e61c5b]#e61c5b[/#e61c5b], CRITICAL: [#f50a19]#f50a19[/#f50a19]}, filesystem_handler: FilesystemHandler(BaseFilesystemHandler), level: LoggingLevel.DEBUG, file: ./test.log}"
}
INFO MainThread 25.10.2022 17:00:49 CEST: Info
WARNING MainThread 25.10.2022 17:00:49 CEST: Warn
ERROR MainThread 25.10.2022 17:00:49 CEST: Error
CRITICAL MainThread 25.10.2022 17:00:49 CEST: Critical
DEBUG Thread-1 25.10.2022 17:00:49 CEST: Running in Thread-1 (testThread)
INFO Thread-1 25.10.2022 17:00:49 CEST: Thread running time 1
DEBUG Thread-1 25.10.2022 17:00:50 CEST: Running in Thread-1 (testThread)
INFO Thread-1 25.10.2022 17:00:50 CEST: Thread running time 2
DEBUG Thread-1 25.10.2022 17:00:51 CEST: Running in Thread-1 (testThread)
INFO Thread-1 25.10.2022 17:00:51 CEST: Thread running time 3
DEBUG Thread-1 25.10.2022 17:00:52 CEST: Running in Thread-1 (testThread)
INFO Thread-1 25.10.2022 17:00:52 CEST: Thread running time 4
Class tree
class slofop.Logger:
def __init__(
self,
logfile_path: str = None,
show_threads: bool = True,
level: LoggingLevel = LoggingLevel.INFO,
colors: ColorFormat = {
LoggingLevel.DEBUG: "#c7dcff",
LoggingLevel.INFO: "#3caae6",
LoggingLevel.WARNING: "#e0c528",
LoggingLevel.ERROR: "#e61c5b",
LoggingLevel.CRITICAL: "#f50a19",
},
time_format_file: str = "%d.%m.%Y %H:%M:%S",
time_format_console: str = "%H:%M:%S",
filesystem_handler: Type[BaseFilesystemHandler] = BaseFilesystemHandler(
),
) -> None
def debug(*elements) -> None
def info(*elements) -> None
def warn(*elements) -> None
def error(*elements) -> None
def critical(*elements) -> None
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
slofop-0.3.0.tar.gz
(5.8 kB
view details)
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 slofop-0.3.0.tar.gz.
File metadata
- Download URL: slofop-0.3.0.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.15.0-1022-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fca54af40aa6ae548ad48cf160a005a82d02eafa78e18d19c4ddb338a9b02c12
|
|
| MD5 |
1e346f95f81e24bfcbfca6868e4d2147
|
|
| BLAKE2b-256 |
3eeb6307c0ce696a8cec967bf68853cda39f357352c1b78ac67ade064a1ee8d4
|
File details
Details for the file slofop-0.3.0-py3-none-any.whl.
File metadata
- Download URL: slofop-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.2 CPython/3.10.7 Linux/5.15.0-1022-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f85f859e2d1a8b92d0960fe0a9689f56475bbd511a956a0eb5fbc7517aa05c6e
|
|
| MD5 |
edf6f604dae05e1d1ad5b19c93ac976c
|
|
| BLAKE2b-256 |
048b122f9bb9f29d6f9ca1f264e040714fd80a8a40491efe417ec2ed36a2d846
|