debuglogger

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RedactedQueryParamsTag logger.LogFunc = func(output logger.Buffer, ctx fiber.Ctx, _ *logger.Data, _ string) (int, error) {
	return output.WriteString(RedactedQueryString(ctx.Request().URI().QueryArgs()))
}

RedactedQueryParamsTag is a logger.LogFunc that replaces the fiber logger middleware's built-in ${queryParams} tag with a redacted query string (see RedactedQueryString). Register it as a CustomTags override for logger.TagQueryStringParams so the default (non-debug) access log never writes credential-bearing query parameters such as WebIdentityToken or X-Amz-Security-Token.

Functions

func IAMLogf

func IAMLogf(format string, v ...any)

IAMLogf is the same as 'fmt.Printf' with debug prefix, a color added and '\n' at the end

func Infof

func Infof(format string, v ...any)

Infof prints out green info block with [INFO]: prefix

func InternalError added in v1.2.0

func InternalError(er error)

InternalError prints the internal error out in the console

func IsDebugEnabled

func IsDebugEnabled() bool

IsDebugEnabled returns true when the debug logger produces output, at either LevelDebug or LevelUnsafe.

func IsIAMDebugEnabled

func IsIAMDebugEnabled() bool

IsIAMDebugEnabled returns true if IAM subsystem debugging is enabled: the --iam-debug flag was set and the log level is not silent.

func IsUnsafeEnabled added in v1.8.0

func IsUnsafeEnabled() bool

IsUnsafeEnabled returns true when the debug logger is configured to print secrets and tokens without masking.

func LogFiberRequestDetails

func LogFiberRequestDetails(ctx fiber.Ctx)

Logs http request details: headers, body, params, query args

func LogFiberResponseDetails

func LogFiberResponseDetails(ctx fiber.Ctx)

Logs http response details: body, headers

func Logf

func Logf(format string, v ...any)

Logf is the same as 'fmt.Printf' with debug prefix, a color added and '\n' at the end

func Panic added in v1.0.19

func Panic(er error)

Panic prints the panics out in the console

func PrintInsideHorizontalBorders

func PrintInsideHorizontalBorders(color Color, title, text string, width int)

PrintInsideHorizontalBorders prints the text inside horizontal border and title in the center of upper border

func RedactedQueryString added in v1.8.0

func RedactedQueryString(queryArgs *fasthttp.Args) string

RedactedQueryString rebuilds the request's query string with sensitive parameter values (see sensitiveFieldNames) replaced by redactedValue. It is safe to write to any log, including the default (non-debug) access log.

func SetIAMDebugEnabled

func SetIAMDebugEnabled()

SetIAMDebugEnabled sets the IAM debug mode

func SetLevel added in v1.8.0

func SetLevel(l Level)

SetLevel sets the active debug log level.

Types

type Color

type Color string
const (
	Purple Color = "\033[0;35m"
)

type Level added in v1.8.0

type Level int32

Level controls both whether the debug logger produces any output and, when it does, whether secrets and tokens embedded in that output are masked.

const (
	// LevelSilent prints no debug logs. This is the default.
	LevelSilent Level = iota
	// LevelDebug prints full request/response logs with secrets and
	// tokens (access keys, session tokens, signatures, ...) masked.
	LevelDebug
	// LevelUnsafe prints full request/response logs with secrets and
	// tokens shown in the clear. Anyone with access to this output can
	// read and replay credentials directly; never use in production.
	LevelUnsafe
)

func CurrentLevel added in v1.8.0

func CurrentLevel() Level

CurrentLevel returns the active debug log level.

func ParseLevel added in v1.8.0

func ParseLevel(s string) (Level, error)

ParseLevel parses "silent", "debug", or "unsafe" (case-insensitive) into a Level. An empty string parses as LevelSilent.

func (Level) String added in v1.8.0

func (l Level) String() string

Jump to

Keyboard shortcuts

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