stellarmesh-logging
stellarmesh-logging 为 Python 3.11 及以上项目提供标准库 logging 的安全单行 JSON Formatter。0.3.0 不包含远程 Client、HTTP token、后台线程、Kafka、spool、数据库表或日志级别策略,也没有运行时第三方依赖。
pip install stellarmesh-logging==0.3.0
import logging
import sys
from stellarmesh_logging import JSONFormatter
handler = logging.StreamHandler(sys.stdout)
handler.setFormatter(
JSONFormatter(
static_fields={
"service": "orders-api",
"environment": "production",
}
)
)
logger = logging.getLogger("orders")
logger.setLevel(logging.INFO)
logger.addHandler(handler)
logger.info(
"request completed",
extra={"request_id": "request-1", "duration_ms": 12.5},
)
每条记录包含 time、level、msg 和 logger。项目可以用 static_fields 声明稳定字段,并通过 LogRecord.extra 添加自己的顶层字段;基础保留字段不能被覆盖。Formatter 支持异常结构化、Unicode、嵌套值、敏感字段规范化脱敏,以及消息、字符串、属性数量和嵌套深度限制。
Formatter 不拥有 StreamHandler 或文件描述符。输出到 stdout、stderr、文件或其他目标,日志等级和 Handler 生命周期都由项目使用 Python 标准库配置。推荐输出结构化 stdout,再由项目自己的 Vector 等 Collector完成有界持久缓冲、恢复重放和数据库投影。
0.2.0 是旧远程 Logging v2 客户端的最后版本。0.3.0 是有意的破坏性版本,删除了 Client、LogEvent、StellarmeshHandler、结构化审计门面和关闭入口;仍依赖旧 API 的项目必须先完成 Collector迁移,不能直接升级。事务性审计应写入业务数据库或 transactional outbox,不能把普通 stdout日志当作合规级不可丢失记录。
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 stellarmesh_logging-0.3.0.tar.gz.
File metadata
- Download URL: stellarmesh_logging-0.3.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40daaf64f3df799868c2fc0e04e175cf0cb712454f744e92b9393caacbd764ca
|
|
| MD5 |
7281ab161ebed57b9e2c5370fc3ba924
|
|
| BLAKE2b-256 |
db49fd4be7c1b23d3a0a40dab15cf6be1e69d811f86aba2c7c1a65d4aa1231aa
|
Provenance
The following attestation bundles were made for stellarmesh_logging-0.3.0.tar.gz:
Publisher:
release-python.yml on L1ndenbaum/stellarmesh-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stellarmesh_logging-0.3.0.tar.gz -
Subject digest:
40daaf64f3df799868c2fc0e04e175cf0cb712454f744e92b9393caacbd764ca - Sigstore transparency entry: 2713348387
- Sigstore integration time:
-
Permalink:
L1ndenbaum/stellarmesh-sdk@2489e65270495b3f773e5c90f2bf075f4bf3eb0f -
Branch / Tag:
refs/tags/sdk/python/logging/v0.3.0 - Owner: https://github.com/L1ndenbaum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@2489e65270495b3f773e5c90f2bf075f4bf3eb0f -
Trigger Event:
push
-
Statement type:
File details
Details for the file stellarmesh_logging-0.3.0-py3-none-any.whl.
File metadata
- Download URL: stellarmesh_logging-0.3.0-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
703a9744f149a24bda6e55532e13328ed3dee1ef066276ddba66742da1cb5ae0
|
|
| MD5 |
65a877afeb0cf4fa3d576cbdf15a341f
|
|
| BLAKE2b-256 |
58ceb73adb58d2b4ba7aa93ab7ae76e9d78280e4266dd65c5b648e9db0a222d6
|
Provenance
The following attestation bundles were made for stellarmesh_logging-0.3.0-py3-none-any.whl:
Publisher:
release-python.yml on L1ndenbaum/stellarmesh-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stellarmesh_logging-0.3.0-py3-none-any.whl -
Subject digest:
703a9744f149a24bda6e55532e13328ed3dee1ef066276ddba66742da1cb5ae0 - Sigstore transparency entry: 2713348664
- Sigstore integration time:
-
Permalink:
L1ndenbaum/stellarmesh-sdk@2489e65270495b3f773e5c90f2bf075f4bf3eb0f -
Branch / Tag:
refs/tags/sdk/python/logging/v0.3.0 - Owner: https://github.com/L1ndenbaum
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@2489e65270495b3f773e5c90f2bf075f4bf3eb0f -
Trigger Event:
push
-
Statement type: