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 ¶
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.