Documentation
¶
Index ¶
- Variables
- func IAMLogf(format string, v ...any)
- func Infof(format string, v ...any)
- func InternalError(er error)
- func IsDebugEnabled() bool
- func IsIAMDebugEnabled() bool
- func IsUnsafeEnabled() bool
- func LogFiberRequestDetails(ctx fiber.Ctx)
- func LogFiberResponseDetails(ctx fiber.Ctx)
- func Logf(format string, v ...any)
- func Panic(er error)
- func PrintInsideHorizontalBorders(color Color, title, text string, width int)
- func RedactedQueryString(queryArgs *fasthttp.Args) string
- func SetIAMDebugEnabled()
- func SetLevel(l Level)
- type Color
- type Level
Constants ¶
This section is empty.
Variables ¶
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 ¶
IAMLogf is the same as 'fmt.Printf' with debug prefix, a color added and '\n' at the end
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 ¶
Logs http request details: headers, body, params, query args
func LogFiberResponseDetails ¶
Logs http response details: body, headers
func PrintInsideHorizontalBorders ¶
PrintInsideHorizontalBorders prints the text inside horizontal border and title in the center of upper border
func RedactedQueryString ¶ added in v1.8.0
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.
Types ¶
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
ParseLevel parses "silent", "debug", or "unsafe" (case-insensitive) into a Level. An empty string parses as LevelSilent.