Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Debug ¶
type Debug struct { // ComponentName is the component name. ComponentName string // OutputName is the output name. OutputName string // Content of the debug env var. Content string // Levels matcher regex matches against any valid level, specified at the // beginning of the debug env var, examples: // - SYPL_DEBUG="info,componentX:outputY:debug,outputZ:trace" -> `info` // - SYPL_DEBUG="componentX:outputY:debug,outputZ:trace,info" -> “. // // Note: For this matcher, the order matter! Levels *regexp.Regexp // Output, and levels matcher regex matches against a specific output, and // any valid level specified in the debug env var, example: // - SYPL_DEBUG="info,componentX:outputY:debug,outputZ:trace" -> `trace` OutputLevels *regexp.Regexp // COL matches against a specific component and output, and any valid level // specified in the debug env var, example: // - SYPL_DEBUG="info,componentX:outputY:debug,outputZ:trace" -> `debug`. ComponentOutputLevels *regexp.Regexp }
Debug definition.
func (*Debug) Level ¶
Level checks the content of the debug env var against all matchers returning: - The level extracted from the last Matcher - The last `Matcher` that matched - If any matcher succeeded on matching
Matchers: - {componentName:outputName:level} -> forwarder:console:trace - {outputName:level} -> console:trace - {level}, e.g.: trace
Note: Don't use the returned level to check if `Level` succeeded because `level.None` is a valid, and usable level.
func (*Debug) MatchCOL ¶
MatchCOL uses the `ComponentOutputLevels` matcher against a specific component and output, and any valid level specified in the debug env var, example: - SYPL_DEBUG="info,componentX:outputY:debug,outputZ:trace" -> `debug`.
Note: Prefer to use the `Level` method.
func (*Debug) MatchL ¶
MatchL uses the `Levels` matcher against any valid level, specified at the beginning of the debug env var, examples: - SYPL_DEBUG="info,componentX:outputY:debug,outputZ:trace" -> `info` - SYPL_DEBUG="componentX:outputY:debug,outputZ:trace,info" -> “.
Notes: - For this matcher, the order matter! - Prefer to use the `Level` method.
type Matcher ¶
type Matcher string
const ( // L matches against any valid level, specified at the beginning of the // debug env var, examples: // - SYPL_DEBUG="info,componentX:outputY:debug,outputZ:trace" -> `info` // - SYPL_DEBUG="componentX:outputY:debug,outputZ:trace,info" -> “. // // Note: For this matcher, the order matter! L Matcher = "Level" // OL matches against a specific output, and any valid level specified in // the debug env var, example: // - SYPL_DEBUG="info,componentX:outputY:debug,outputZ:trace" -> `trace`. OL Matcher = "OutputLevel" // COL matches against a specific component and output, and any valid level // specified in the debug env var, example: // - SYPL_DEBUG="info,componentX:outputY:debug,outputZ:trace" -> `debug`. COL Matcher = "ComponentOutputLevel" // None means no Matcher matched against the debug env var. None Matcher = "None" )