Documentation ¶
Index ¶
- func GrpcClientLoggerUnary(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, ...) error
- func GrpcServerLoggerUnary(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, ...) (interface{}, error)
- func HandlerJson(ctx context.Context, in *glog.HandlerInput)
- func HttpAccessLogMiddleware(r *ghttp.Request)
- func HttpClientLogMiddleware(c *gclient.Client, r *http.Request) (response *gclient.Response, err error)
- func HttpErrorLogMiddleware(r *ghttp.Request)
- func HttpLogFormatJsonMiddleware(r *ghttp.Request)
- type ErrorLog
- type GrpcAccessLog
- type GrpcClientLog
- type HandlerOutputJson
- type HttpAccessLog
- type HttpClientLog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GrpcClientLoggerUnary ¶
func GrpcClientLoggerUnary(ctx context.Context, method string, req, reply any, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error
GrpcClientLoggerUnary grpc客户端日志拦截器
func GrpcServerLoggerUnary ¶
func GrpcServerLoggerUnary( ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler, ) (interface{}, error)
GrpcServerLoggerUnary grpc服务端日志拦截器
func HandlerJson ¶
func HandlerJson(ctx context.Context, in *glog.HandlerInput)
func HttpAccessLogMiddleware ¶
func HttpClientLogMiddleware ¶
func HttpErrorLogMiddleware ¶
Types ¶
type ErrorLog ¶
type GrpcAccessLog ¶
type GrpcClientLog ¶
type HandlerOutputJson ¶
type HandlerOutputJson struct { Time string `json:"time"` // Formatted time string, like "2016-01-09 12:00:00". TraceId string `json:"trace_id,omitempty"` // Trace id, only available if tracing is enabled. Category string `json:"category"` CtxStr string `json:"ctx_str,omitempty"` // The retrieved context value string from context, only available if Config.CtxKeys configured. Level string `json:"level"` // Formatted level string, like "DEBU", "ERRO", etc. Eg: ERRO CallerFunc string `json:"caller_func,omitempty"` // The source function name that calls logging, only available if F_CALLER_FN set. CallerPath string `json:"caller_path,omitempty"` // The source file path and its line number that calls logging, only available if F_FILE_SHORT or F_FILE_LONG set. Prefix string `json:"prefix,omitempty"` // Custom prefix string for logging content. Content any `json:"content"` // Content is the main logging content, containing error stack string produced by logger. Stack string `json:"stack,omitempty"` // Stack string produced by logger, only available if Config.StStatus configured. }
type HttpAccessLog ¶
type HttpAccessLog struct { HttpCode int `json:"http_code"` Scheme string `json:"scheme"` Method string `json:"method"` Host string `json:"host"` Path string `json:"path"` Cost float64 `json:"cost"` Req map[string]interface{} `json:"req"` Res interface{} `json:"res"` Ip string `json:"ip"` Header http.Header `json:"header"` }
func (HttpAccessLog) Log ¶
func (l HttpAccessLog) Log(ctx context.Context)
type HttpClientLog ¶
type HttpClientLog struct { HttpCode int `json:"http_code"` Scheme string `json:"scheme"` Method string `json:"method"` Host string `json:"host"` Path string `json:"path"` Cost string `json:"cost"` Req map[string]interface{} `json:"req"` Res interface{} `json:"res"` Header http.Header `json:"header"` }
func (HttpClientLog) Log ¶
func (l HttpClientLog) Log(ctx context.Context)
Click to show internal directories.
Click to hide internal directories.