utils

package
v0.18.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2025 License: MIT Imports: 4 Imported by: 0

README

Logging Utils

This package provides internal utilities for the logging packages. It is not intended for direct use in applications.

Components

Context Extraction

Extracts user and request data from HTTP context:

func ExtractFromContext(ctx context.Context) (username string, requestId string)
Structured Logger Configuration

Provides a pre-configured slog logger with custom field mappings:

  • timetimestamp
  • levellog_level
  • msgpayload
func NewSlogger() *slog.Logger
func ReplaceDefaultKeys(groups []string, attr slog.Attr) slog.Attr

Usage

This package is used internally by:

  • accesslog - HTTP access logging
  • applog - Application logging
  • tracelog - Request tracing
  • transactionlog - Transaction logging

For application logging, use the specific logging packages instead of these utilities directly.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractFromContext

func ExtractFromContext(ctx context.Context) (username string, requestId string)

func NewSlogger

func NewSlogger() *slog.Logger

func ReplaceDefaultKeys

func ReplaceDefaultKeys(groups []string, attr slog.Attr) slog.Attr

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL