Documentation ¶
Index ¶
- Constants
- func Debug(ctx context.Context, message string, args ...any)
- func Error(ctx context.Context, err error, message string, args ...any)
- func GinLoggingMiddleware() gin.HandlerFunc
- func Info(ctx context.Context, message string, args ...any)
- func Initialize(level slog.Level, ver, apiName, buildDate, commitHash, env string, ...)
- func ParseHeaders(headers map[string][]string) (hdrMap []any)
- func ParseUserAgent(rawUserAgent string) (uaMap []any)
- func Warn(ctx context.Context, message string, args ...any)
Constants ¶
View Source
const ( ServiceNameAttr = "dd.service" ServiceVersionAttr = "dd.version" ServiceEnvAttr = "dd.env" TraceIDAttr = "dd.trace_id" SpanIDAttr = "dd.span_id" LogSourceAttr = "ddsource" BuildDate = "build_date" Commit = "commit" Host = "host" HttpMethod = "http.request.method" HttpPath = "http.request.path" HttpRemoteAddr = "http.request.remoteAddr" HttpStatus = "http.response.status" HttpLatency = "http.response.latency" LogLevel = "level" )
View Source
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 slog.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 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.
Click to show internal directories.
Click to hide internal directories.