Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConsoleCore ¶ added in v1.0.3
func NewConsoleCore(level zapcore.LevelEnabler) zapcore.Core
NewConsoleCore 构造一个输出到 stdout 的 console encoder core。
设计要点: - 采用 ProductionEncoderConfig,字段与 zap 默认生产格式保持一致 - 通过自定义 EncodeTime/EncodeLevel/EncodeCaller,把输出变成更利于人读的形式 - 返回的 Core 可与 JSON Core 通过 zapcore.NewTee 合并
func NewRemoteCore ¶ added in v1.0.3
func NewRemoteCore(level zapcore.LevelEnabler, handle func(b []byte)) zapcore.Core
NewRemoteCore 构造一个远端输出 core。
该 core 的目标是减少额外编解码:直接在 core.Write 中组装目标 JSON,并调用 handle。
Types ¶
type AccessLogger ¶ added in v0.8.3
type AccessLogger struct {
Method uint32 `json:"method"`
Path string `json:"path"`
Request string `json:"request"`
Response string `json:"response"`
Duration uint64 `json:"duration"`
Status uint32 `json:"status"`
ClientIp string `json:"client_ip"`
SourceIp string `json:"source_ip"`
SourceIpAddress string `json:"source_ip_address"`
ClientType uint32 `json:"client_type"`
ClientName string `json:"client_name"`
ClientVersion string `json:"client_version"`
SystemType uint32 `json:"system_type"`
SystemName string `json:"system_name"`
SystemVersion string `json:"system_version"`
AppVersion string `json:"app_version"`
InvokeServiceAppId string `json:"invoke_service_app_id"`
InvokeServiceEndpoint string `json:"invoke_service_endpoint"`
TargetServiceAppId string `json:"target_service_app_id"`
TargetServiceEndpoint string `json:"target_service_endpoint"`
TraceId string `json:"trace_id"`
ParentId string `json:"parent_id"`
SpanId string `json:"span_id"`
UserId string `json:"user_id"`
AppId string `json:"app_id"`
TenantId string `json:"tenant_id"`
}
AccessLogger 表示访问日志。
type Conf ¶ added in v1.0.3
type Conf struct {
Console bool `json:"console"`
Remote bool `json:"remote"`
// contains filtered or unexported fields
}
Conf 是 logger 的配置项 - Console:是否启用控制台输出 - Remote:是否启用远端输出(需要同时提供 handle 才会生效)
func (*Conf) WithHandle ¶ added in v1.0.3
WithHandle 设置远端输出回调
type Core ¶ added in v1.0.3
type OperationLogger ¶ added in v0.9.1
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"`
TargetAppId string `json:"target_app_id"`
InvokeAppId string `json:"invoke_app_id"`
UserId string `json:"user_id"`
AppId string `json:"app_id"`
TenantId string `json:"tenant_id"`
}
OperationLogger 表示操作日志。
type ServerLogger ¶ added in v0.9.1
type ServerLogger struct {
Path string `json:"path"`
Level uint32 `json:"level"`
Content string `json:"content"`
TraceId string `json:"trace_id"`
ParentId string `json:"parent_id"`
UserId string `json:"user_id"`
AppId string `json:"app_id"`
TenantId string `json:"tenant_id"`
}
ServerLogger 表示服务端日志。
Click to show internal directories.
Click to hide internal directories.