Documentation ¶
Overview ¶
Package log provides an interface to setup logging when using 'tools-common'.
Index ¶
- func MaskAndUserTagArguments(args, flagsToTag, flagsToMask []string) string
- func MaskAndUserTagCBMArguments(args []string) string
- func MaskArguments(args, flagsToMask []string) []string
- func MaskCBMArguments(args []string) []string
- func UserTagArguments(args, flagsToTag []string) []string
- func UserTagCBMArguments(args []string) []string
- type Level
- type Logger
- type StdoutLogger
- type WrappedLogger
- func (w *WrappedLogger) Debugf(format string, args ...any)
- func (w *WrappedLogger) Errorf(format string, args ...any)
- func (w *WrappedLogger) Infof(format string, args ...any)
- func (w *WrappedLogger) Panicf(format string, args ...any)
- func (w *WrappedLogger) Tracef(format string, args ...any)
- func (w *WrappedLogger) Warnf(format string, args ...any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaskAndUserTagArguments ¶
MaskAndUserTagArguments is a convenient way of calling both UserTagArguments and MaskArguments on the given data. It will return the resulting string slice joined with a space between element for easy logging.
func MaskArguments ¶
MaskArguments returns a new slice with the values of the flags given in flagsToMask replaced by a fix number of *.
func MaskCBMArguments ¶
func UserTagArguments ¶
UserTagArguments returns a new slice with the values for the flags given in flagsToTag surrounded by the <ud></ud> tags.
func UserTagCBMArguments ¶
Types ¶
type Level ¶
type Level uint8
Level is a type alias which is used to indicate the verbosity of an log statement.
const ( // LevelTrace is the most verbose log level including finer grained informational events than debug level. LevelTrace Level = iota // LevelDebug includes fine-grained informational events that are the most useful to debug the library. LevelDebug // LevelInfo includes informational messages that highlight the progress of events in the library at a // course-grained level. LevelInfo // LevelWarning includes expected but potentially harmful/interesting events. LevelWarning // LevelError includes error events which may still allow the library to continue running. LevelError // LevelPanic includes errors events which should lead to a panic. This level will only be used in the most severe // of cases. LevelPanic )
type StdoutLogger ¶
type StdoutLogger struct{}
StdoutLogger is the standard output logger for printing all logs into the commandline.
type WrappedLogger ¶
type WrappedLogger struct {
Logger
}
WrappedLogger is the internally used Logger struct that implements Logger and defines varous methods for different levels of logging, eg: trace, debug, info, etc.
func NewWrappedLogger ¶
func NewWrappedLogger(logger Logger) WrappedLogger
NewWrappedLogger returns a WrappedLogger for a given inputted Logger. If logger is nil then assign the nopLogger.
func (*WrappedLogger) Debugf ¶
func (w *WrappedLogger) Debugf(format string, args ...any)
Debugf logs the provided information at the debug level.
func (*WrappedLogger) Errorf ¶
func (w *WrappedLogger) Errorf(format string, args ...any)
Errorf logs the provided information at the error level.
func (*WrappedLogger) Infof ¶
func (w *WrappedLogger) Infof(format string, args ...any)
Infof logs the provided information at the info level.
func (*WrappedLogger) Panicf ¶
func (w *WrappedLogger) Panicf(format string, args ...any)
Panicf logs the provided information at the panic level.
func (*WrappedLogger) Tracef ¶
func (w *WrappedLogger) Tracef(format string, args ...any)
Tracef logs the provided information at the trace level.
func (*WrappedLogger) Warnf ¶
func (w *WrappedLogger) Warnf(format string, args ...any)
Warnf logs the provided information at the warn level.