Discover Packages
github.com/FlanChanXwO/pixiv-cli
internal
logging
package
Version:
v1.4.0
Opens a new window with list of versions in this module.
Published: Nov 21, 2026
License: MIT
Opens a new window with license information.
Imports: 13
Opens a new window with list of imports.
Imported by: 0 modules, 0 packages
The first number is the count of modules that contain a package that imports this one.
The module count is a better indicator of popularity than the package count.
A module with 100 importing packages is counted only once instead of 100 times,
reflecting the fact that the choice to use the package was likely made only once,
not 100 times.
A '?' means that the value hasn't been computed yet.
Opens a new window with list of known importers.
Documentation
Documentation
¶
Package logging 提供 CLI 与 MCP 的 slog 层:ctx 中的调用信息、属性键常量和
可配置的 text/JSON handler。
WithCall 由执行边界写入 operation 与 call_id,之后同一 ctx 上的日志都会附带这些
字段;SDK 使用默认 slog logger,属性键由各 SDK 自持。
包的组成:New 创建带调用上下文与脱敏行为的 handler,From 从 ctx 取 logger,
AttrOperation 等常量是执行边界的字段名,WithCall 负责绑定。
View Source
const (
FormatText = "text"
FormatJSON = "json"
)
View Source
const (
AttrDuration = "duration"
AttrError = "error"
AttrCount = "count"
AttrStage = "stage"
AttrOperation = "operation"
AttrCallID = "call_id"
AttrReason = "reason"
)
AttrOperation 等常量是执行边界与 JSON 输出使用的日志属性键。
Discard 返回不输出任何记录的 logger。
From 返回 ctx 中的 logger;没有时返回丢弃所有输出的 logger。
HasLogger 报告 ctx 是否携带执行边界放入的 logger。
New 按配置创建 logger;level 接受 debug、info、warn、error。
WithCall 把调用信息和 logger 放进 ctx;同一次调用的所有日志都会附带这些信息。
State 保存一次执行的 logger、调用上下文与失败记录的级别。
Start 为一次命令执行创建 stderr logger 与带调用 ID 的上下文;JSON 格式把
失败记录提升到 ERROR,文本格式使用 DEBUG。
Source Files
¶
Click to show internal directories.
Click to hide internal directories.