Documentation ¶
Index ¶
- func NewProcessingError(m message.IMessage, e error) error
- type Casing
- type IProcessor
- func ChangeFirstCharCase(casing Casing) IProcessor
- func ColorizeBasedOnLevel(levelColorMap map[level.Level]color.Color) IProcessor
- func ColorizeBasedOnWord(wordColorMap map[string]color.Color) IProcessor
- func Decolourizer() IProcessor
- func ErrorSimulator(msg string) IProcessor
- func ForceBasedOnLevel(levels ...level.Level) IProcessor
- func MuteBasedOnLevel(levels ...level.Level) IProcessor
- func New(name string, f RunFunc) IProcessor
- func PrefixBasedOnMask(timestampFormat string) IProcessor
- func PrefixBasedOnMaskExceptForLevels(timestampFormat string, levels ...level.Level) IProcessor
- func Prefixer(prefix string) IProcessor
- func PrintOnlyAtLevel(l level.Level) IProcessor
- func PrintOnlyIfTagged(tag string) IProcessor
- func Suffixer(suffix string) IProcessor
- type ProcessingError
- type RunFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type IProcessor ¶
type IProcessor interface { meta.IMeta // String interface. String() string // Run the processor, if enabled. Run(m message.IMessage) error }
IProcessor specifies what a processor does.
func ChangeFirstCharCase ¶
func ChangeFirstCharCase(casing Casing) IProcessor
ChangeFirstCharCase changes message content's first char to the specified case.
Notes: - `casing` because `case` is a reserved word. - Order matters! If this comes after another processor like the Prefixer, it will change the case of the first char of the Prefix mask, not the message content!
func ColorizeBasedOnLevel ¶
func ColorizeBasedOnLevel(levelColorMap map[level.Level]color.Color) IProcessor
ColorizeBasedOnLevel colorize messages based on the specified levels.
func ColorizeBasedOnWord ¶
func ColorizeBasedOnWord(wordColorMap map[string]color.Color) IProcessor
ColorizeBasedOnWord colorize a messages with the specified colors if a message contains a specific word.
func ErrorSimulator ¶
func ErrorSimulator(msg string) IProcessor
ErrorSimulator simulates an error in the pipeline.
func ForceBasedOnLevel ¶
func ForceBasedOnLevel(levels ...level.Level) IProcessor
ForceBasedOnLevel force messages to be printed based on the specified levels.
func MuteBasedOnLevel ¶
func MuteBasedOnLevel(levels ...level.Level) IProcessor
MuteBasedOnLevel mute messages based on the specified levels.
func New ¶ added in v1.4.0
func New(name string, f RunFunc) IProcessor
New is the Processor factory.
func PrefixBasedOnMask ¶
func PrefixBasedOnMask(timestampFormat string) IProcessor
PrefixBasedOnMask prefixes messages with the predefined mask.
Example: 2021-06-22 12:51:46.089 [80819] [CLI] [Info].
func PrefixBasedOnMaskExceptForLevels ¶
func PrefixBasedOnMaskExceptForLevels(timestampFormat string, levels ...level.Level) IProcessor
PrefixBasedOnMaskExceptForLevels is a specialized version of the `PrefixBasedOnMask`. It prefixes all messages, except for the specified levels.
func Prefixer ¶
func Prefixer(prefix string) IProcessor
Prefixer prefixes a message with the specified `prefix`.
func PrintOnlyAtLevel ¶ added in v1.3.6
func PrintOnlyAtLevel(l level.Level) IProcessor
PrintOnlyAtLevel prints only if message is at the specified level.
func PrintOnlyIfTagged ¶ added in v1.3.6
func PrintOnlyIfTagged(tag string) IProcessor
PrintOnlyIfTagged prints only if message contains the specified tag.
func Suffixer ¶
func Suffixer(suffix string) IProcessor
Suffixer suffixes a message with the specified `suffix`.
type ProcessingError ¶
type ProcessingError struct { // Cause is the underlying case of the failure. Cause error // Message when the failured happened. Message message.IMessage // OutputName is the name of the output in-use. OutputName string // ProcessorName is the name of the processor in-use. ProcessorName string }
ProcessingError is thrown when a processor fails.
func (*ProcessingError) Error ¶
func (p *ProcessingError) Error() string
Error interface implementation.