Documentation ¶
Index ¶
- Constants
- func Debug(ctx context.Context, message string, args map[string]any)
- func Error(ctx context.Context, err error, message string, args map[string]any)
- func Fatal(ctx context.Context, err error, message string, args map[string]any)
- func GinLoggingMiddleware() gin.HandlerFunc
- func Info(ctx context.Context, message string, args map[string]any)
- func Initialize(level zerolog.Level, ver, apiName, buildDate, commitHash, env string, ...)
- func Logger() *zerolog.Logger
- func ParseHeaders(headers map[string][]string) (args map[string]any)
- func ParseUserAgent(rawUserAgent string) (args map[string]any)
- func Warn(ctx context.Context, message string, args map[string]any)
Constants ¶
const ( TraceIDAttr = "dd.trace_id" SpanIDAttr = "dd.span_id" HttpMethod = "http.request.method" HttpPath = "http.request.path" HttpRemoteAddr = "http.request.remoteAddr" HttpStatus = "http.response.status" HttpLatency = "http.response.latency" LogLevel = "level" )
const ( UserAgentOS = "http.user_agent.os" UserAgentOSVersion = "http.user_agent.os_version" UserAgentDevice = "http.user_agent.device" UserAgentBrowser = "http.user_agent.browser" UserAgentBrowserVersion = "http.user_agent.browser_version" BrowserChrome = "chrome" BrowserSafari = "safari" BrowserFirefox = "firefox" BrowserOpera = "opera" BrowserIE = "ie" BrowserEdge = "edge" BrowserTrident = "Trident" QueryString = "http.query" )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug logs a debug message and adds the trace id and span id fount in the ctx. The args are key value pairs and are optional.
func GinLoggingMiddleware ¶
func GinLoggingMiddleware() gin.HandlerFunc
GinLoggingMiddleware logs the incoming request and starts the trace.
func Info ¶
Info logs an info message and adds the trace id and span id fount in the ctx. The args are key value pairs and are optional.
func Initialize ¶
func Initialize(level zerolog.Level, ver, apiName, buildDate, commitHash, env string, writer io.Writer)
Initialize initializes the logging system. It returns a logger that can be used to log messages, though it is not required.
func Logger ¶ added in v1.0.1
Logger returns a pointer to the logger that is used by the logging system.
func ParseHeaders ¶
ParseHeaders parses the headers and returns a map of attributes.
func ParseUserAgent ¶
ParseUserAgent parses the user agent string and returns a map of attributes.
Types ¶
This section is empty.