Documentation
¶
Index ¶
Constants ¶
View Source
const ( ColorReset = "\033[0m" ColorYellow = "\033[33m" ColorBlueBold = "\033[34;1m" ColorRedBold = "\033[31;1m" ColorGreen = "\033[32m" )
ANSI Color Constants
View Source
const ( // LogTypeMongo 为日志类型标识(供下游聚合检索)。 LogTypeMongo = 6 // ResultSuccess 为成功执行的结果标记。 ResultSuccess = "success" // HeaderPrefix Firefly系统自定义头部(统一前缀) HeaderPrefix = "x-firefly-" // TraceId 为从 metadata 读取 trace id 的 key TraceId = HeaderPrefix + "trace-id" // SpanId 为从 metadata 读取 span id 的 key SpanId = HeaderPrefix + "span-id" // UserId 为从 metadata 读取 user id 的 key UserId = HeaderPrefix + "user-id" // AppId 为从 metadata 读取 app id 的 key AppId = HeaderPrefix + "app-id" )
Log Constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conf ¶
type Conf struct {
// Console 控制是否输出到控制台。
Console bool
// SlowThreshold 为慢查询阈值。
SlowThreshold time.Duration
// Colorful 控制是否启用彩色输出。
Colorful bool
// Database 为库名字段,用于检索与聚合。
Database string
}
Conf 为 logger 的配置。
type Interface ¶
type Interface interface {
// Trace 记录一次命令的执行信息。
Trace(ctx context.Context, id int64, elapsed time.Duration, smt string, err string)
}
Interface 约束 logger 需要提供的能力。
type OperationLogger ¶ added in v0.6.2
type OperationLogger struct {
Database string `json:"database"`
Statement string `json:"statement"`
Result string `json:"result"`
Path string `json:"path"`
Duration uint64 `json:"duration"`
Level uint32 `json:"level"`
Type uint32 `json:"type"`
TraceId string `json:"trace_id"`
ParentId string `json:"parent_id"`
UserId string `json:"user_id"`
TargetAppId string `json:"target_app_id"`
InvokeAppId string `json:"invoke_app_id"`
}
OperationLogger 表示操作日志。
Click to show internal directories.
Click to hide internal directories.