Skip to main content

※下の方に日本語の説明があります

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にできます。 また、どちらの場合であっても、標準出力の他に返値として末尾ログ一覧が返ります。

Metadata

Release files for llog 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for llog 1.4.0
File Size Uploaded Provenance
llog-1.4.0.tar.gz 3.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llog 1.4.0
File Interpreter ABI Platform
llog-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / llog-1.4.0.tar.gz

Download URL llog-1.4.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
25ccf2852371b32cb6d595c0877de345ba9f1c86fd2fc7277ab1d9c9c3c92619
BLAKE2b-256 checksum
How to use checksums
e96a154bac5401923c9853aba1f0a2d5cc489710eca76b4edea3c1451a0b3275
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Release files / llog-1.4.0-py3-none-any.whl

Download URL llog-1.4.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cc2d24f81251b2c9bb47abf2267a3d8a75b8b17b26f83e7499e39ffb6bdba47
BLAKE2b-256 checksum
How to use checksums
88a14a8f9f6bb1d9137fda5eba8afbac3ebcd3bfb9d33c80a7faa06c35e871fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

Security for llog 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page