logger

package
v0.0.17-alpha Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

View Source
const (
	LogKeyError               = "error"
	LogKeyPanicStackTrace     = "panic_stack_trace"
	LogKeySDKVersion          = "sdk_version"
	LogKeyComponentName       = "component_name"
	LogKeyInstanceID          = "instance_id"
	LogKeyComponentType       = "component_type"
	LogKeyNumRawFindings      = "num_raw_findings"
	LogKeyRawFinding          = "raw_finding"
	LogKeyNumParsedFindings   = "num_parsed_findings"
	LogKeyNumFilteredFindings = "num_filtered_findings"
	LogKeyNumEnrichedFindings = "num_enriched_findings"
)

Variables

View Source
var ErrInvalidRunnerConfigLoggingLevel = errors.New("not a valid RunnerConfigLoggingLevel")

Functions

func ContextWithLogger

func ContextWithLogger(ctx context.Context, logger Logger) context.Context

ContextWithLogger returns a context with a logger in its values for reusability.

func NewDefaultLogger

func NewDefaultLogger(level RunnerConfigLoggingLevel) (*defaultLogger, error)

func NewNoopLogger

func NewNoopLogger() *noopLogger

NewNoopLogger can be used to get a NOOP Logger.

Types

type Logger

type Logger interface {
	Debug(msg string, keyvals ...any)
	Info(msg string, keyvals ...any)
	Warn(msg string, keyvals ...any)
	Error(msg string, keyvals ...any)
	With(args ...any) Logger
}

Logger exposes an slog.Logger compatible logger contract.

func LoggerFromContext

func LoggerFromContext(ctx context.Context) Logger

LoggerFromContext extracts a structured logger from the context for reusability.

type RunnerConfigLoggingLevel

type RunnerConfigLoggingLevel string

RunnerConfigLoggingLevel is used to represent log levels. ENUM(debug, info, error, warn)

const (
	// RunnerConfigLoggingLevelDebug is a RunnerConfigLoggingLevel of type debug.
	RunnerConfigLoggingLevelDebug RunnerConfigLoggingLevel = "debug"
	// RunnerConfigLoggingLevelInfo is a RunnerConfigLoggingLevel of type info.
	RunnerConfigLoggingLevelInfo RunnerConfigLoggingLevel = "info"
	// RunnerConfigLoggingLevelError is a RunnerConfigLoggingLevel of type error.
	RunnerConfigLoggingLevelError RunnerConfigLoggingLevel = "error"
	// RunnerConfigLoggingLevelWarn is a RunnerConfigLoggingLevel of type warn.
	RunnerConfigLoggingLevelWarn RunnerConfigLoggingLevel = "warn"
)

func ParseRunnerConfigLoggingLevel

func ParseRunnerConfigLoggingLevel(name string) (RunnerConfigLoggingLevel, error)

ParseRunnerConfigLoggingLevel attempts to convert a string to a RunnerConfigLoggingLevel.

func (RunnerConfigLoggingLevel) IsValid

func (x RunnerConfigLoggingLevel) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (RunnerConfigLoggingLevel) String

func (x RunnerConfigLoggingLevel) String() string

String implements the Stringer interface.

Jump to

Keyboard shortcuts

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