local log (a logging tool that doesn't pollute the global scope)
Project description
※下の方に日本語の説明があります
English description
This package a logging tool that doesn't pollute the global scope.
How to use
from llog import LLog
test_log = LLog("./test_log.log")
test_log.debug({"msg": "test1"})
test_log.debug({"msg": "test2"})
test_log.debug({"msg": "test3"})
Output result: test_log.log
{"date": "2020-09-22 03:32:59.614418", "level": "DEBUG", "summary_stack": {"function": "<module>", "filename": "test_root.py"}, "contents": {"msg": "test1"}}
{"date": "2020-09-22 03:32:59.616413", "level": "DEBUG", "summary_stack": {"function": "<module>", "filename": "test_root.py"}, "contents": {"msg": "test2"}}
{"date": "2020-09-22 03:32:59.617411", "level": "DEBUG", "summary_stack": {"function": "<module>", "filename": "test_root.py"}, "contents": {"msg": "test3"}}
You can check the contents of the log file (the last n entries) as follows:
test_log.tail(n = 2)
Result: standard output (console)
[log #1] {
"date": "2020-09-22 03:32:59.616413",
"level": "DEBUG",
"summary_stack": {
"function": "<module>",
"filename": "test_root.py"
},
"contents": {"msg": "test2"}
}
[log #2] {
"date": "2020-09-22 03:32:59.617411",
"level": "DEBUG",
"summary_stack": {
"function": "<module>",
"filename": "test_root.py"
},
"contents": {"msg": "test3"}
}
日本語の説明
ログの設定範囲を細かく管理できるログツール (他ツールのログ設定と競合しない)
簡単な使い方
from llog import LLog
test_log = LLog("./test_log.log")
test_log.debug({"msg": "test1"})
test_log.debug({"msg": "test2"})
test_log.debug({"msg": "test3"})
出力結果: test_log.log
{"date": "2020-09-22 03:32:59.614418", "level": "DEBUG", "summary_stack": {"function": "<module>", "filename": "test_root.py"}, "contents": {"msg": "test1"}}
{"date": "2020-09-22 03:32:59.616413", "level": "DEBUG", "summary_stack": {"function": "<module>", "filename": "test_root.py"}, "contents": {"msg": "test2"}}
{"date": "2020-09-22 03:32:59.617411", "level": "DEBUG", "summary_stack": {"function": "<module>", "filename": "test_root.py"}, "contents": {"msg": "test3"}}
ログファイルの内容 (末尾n件) を以下のように確認できます。
test_log.tail(n = 2)
結果: 標準出力 (コンソール)
[log #1] {
"date": "2020-09-22 03:32:59.616413",
"level": "DEBUG",
"summary_stack": {
"function": "<module>",
"filename": "test_root.py"
},
"contents": {"msg": "test2"}
}
[log #2] {
"date": "2020-09-22 03:32:59.617411",
"level": "DEBUG",
"summary_stack": {
"function": "<module>",
"filename": "test_root.py"
},
"contents": {"msg": "test3"}
}
なお、 show_flag = False オプション引数で標準出力がoffにできます。 また、どちらの場合であっても、標準出力の他に返値として末尾ログ一覧が返ります。
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 llog-1.4.0.tar.gz.
File metadata
- Download URL: llog-1.4.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25ccf2852371b32cb6d595c0877de345ba9f1c86fd2fc7277ab1d9c9c3c92619
|
|
| MD5 |
45623bace37c91fb0b580fa5cf18af08
|
|
| BLAKE2b-256 |
e96a154bac5401923c9853aba1f0a2d5cc489710eca76b4edea3c1451a0b3275
|
File details
Details for the file llog-1.4.0-py3-none-any.whl.
File metadata
- Download URL: llog-1.4.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cc2d24f81251b2c9bb47abf2267a3d8a75b8b17b26f83e7499e39ffb6bdba47
|
|
| MD5 |
397be12eace9bca245675c71948c3497
|
|
| BLAKE2b-256 |
88a14a8f9f6bb1d9137fda5eba8afbac3ebcd3bfb9d33c80a7faa06c35e871fb
|