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"}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
llog-1.3.1.tar.gz
(3.2 kB
view details)
Built Distribution
llog-1.3.1-py3-none-any.whl
(3.3 kB
view details)
File details
Details for the file llog-1.3.1.tar.gz
.
File metadata
- Download URL: llog-1.3.1.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90e709aba9035a07e5fe31f921d69731fa9d3c7f264db545bbb1381df390f25a |
|
MD5 | c88f13bd4e5205c28cccdcd4d479101e |
|
BLAKE2b-256 | b06ea4625f0b0b6a92dc84e27f5b8f59a8479b47751643a13b67d472cf9e36fd |
File details
Details for the file llog-1.3.1-py3-none-any.whl
.
File metadata
- Download URL: llog-1.3.1-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c786d7ccc66a5661da17302d31786a2dfbc97ba12ca49f21c6cb2a7efb826d40 |
|
MD5 | 52e2d4ed21d3823fc7850c68641ada4a |
|
BLAKE2b-256 | 5a4800c8f32745eff4e22f34358ac4577e342b545de2cc1a97201da3dfc4058a |