Documentation
¶
Index ¶
- Variables
- func AppVersion() version.Version
- func Close()
- func Debug(v ...any)
- func Debugf(format string, v ...any)
- func Debugr(r Record)
- func Deprecate(deprecatedVersion version.Version, removalVersion version.Version, v ...any) (bool, error)
- func DeprecateMsg(deprecatedVersion version.Version, removalVersion version.Version, v ...any) string
- func DisableDeprecate() bool
- func DisableLava() bool
- func DisableLogLevels(options logLevel) bool
- func EnableDeprecate() bool
- func EnableLava() bool
- func EnableLogLevels(options logLevel) bool
- func Error(v ...any)
- func Errorf(format string, v ...any)
- func Errorr(r Record)
- func Fatal(v ...any)
- func Fatalf(format string, v ...any)
- func Fatalr(r Record)
- func Info(v ...any)
- func Infof(format string, v ...any)
- func Infor(r Record)
- func Lava(version version.Version, v ...any) volcano
- func LoadEnv(logger *dnxLogger)
- func LogLevels() logLevel
- func NewClone() *dnxLogger
- func NewConfigs() *configurations
- func NewDefault() *dnxLogger
- func NewWithEnv() *dnxLogger
- func SetLogLevels(options logLevel) bool
- func SetMinLogLevel(level logLevel) bool
- func SetVersion(version version.Version)
- func Warning(v ...any)
- func Warningf(format string, v ...any)
- func Warningr(r Record)
- type AnsiCode
- type AnsiColorScheme
- type AnsiStyle
- type CloseFunc
- type ColorScheme
- type ConsoleColorFormatterBuilder
- func (b ConsoleColorFormatterBuilder) AddColor(nameID string, colorCode AnsiStyle) ConsoleColorFormatterBuilder
- func (b ConsoleColorFormatterBuilder) BaseFormatter(formatter Formatter) ConsoleColorFormatterBuilder
- func (b ConsoleColorFormatterBuilder) DefaultColor(colorCode AnsiStyle) ConsoleColorFormatterBuilder
- func (b ConsoleColorFormatterBuilder) New() Formatter
- func (b ConsoleColorFormatterBuilder) Next(formatter Formatter) FormatterBuilder
- type ConsoleWriterBuilder
- type FileWriterBuilder
- type FormatRecord
- type Formatter
- type FormatterBase
- func (f *FormatterBase) DateFormat() string
- func (f *FormatterBase) DefaultFormat() string
- func (f *FormatterBase) FinalString(original *Record, formatRecord *FormatRecord) string
- func (f *FormatterBase) Format(r *Record, formatRecord ...*FormatRecord) (string, error)
- func (f *FormatterBase) Next() Formatter
- func (f *FormatterBase) SetNext(next Formatter)
- type FormatterBuilder
- type Record
- type Style
- type Writer
- type WriterBuilder
Constants ¶
This section is empty.
Variables ¶
var Ansi = ansiStyle{}
var Flag iFlag
var Level iLevel
var SimpleFormatter simpleFormatterBuilder = simpleFormatterBuilder{ // contains filtered or unexported fields }
var TerminationCode iTerminationCode
Functions ¶
func AppVersion ¶
func DeprecateMsg ¶
func DisableDeprecate ¶
func DisableDeprecate() bool
func DisableLava ¶
func DisableLava() bool
func DisableLogLevels ¶
func DisableLogLevels(options logLevel) bool
func EnableDeprecate ¶
func EnableDeprecate() bool
func EnableLava ¶
func EnableLava() bool
func EnableLogLevels ¶
func EnableLogLevels(options logLevel) bool
func NewConfigs ¶
func NewConfigs() *configurations
NewConfigs initializes a new configs instance with default values
func NewDefault ¶
func NewDefault() *dnxLogger
func NewWithEnv ¶
func NewWithEnv() *dnxLogger
func SetLogLevels ¶
func SetLogLevels(options logLevel) bool
func SetMinLogLevel ¶
func SetMinLogLevel(level logLevel) bool
func SetVersion ¶
Types ¶
type AnsiCode ¶
type AnsiCode string
const ( TXT_BLACK AnsiCode = "30m" TXT_RED AnsiCode = "31m" TXT_GREEN AnsiCode = "32m" TXT_YELLOW AnsiCode = "33m" TXT_BLUE AnsiCode = "34m" TXT_MAGENTA AnsiCode = "35m" TXT_CYAN AnsiCode = "36m" TXT_WHITE AnsiCode = "37m" BG_BLACK AnsiCode = "40" BG_RED AnsiCode = "41" BG_GREEN AnsiCode = "42" BG_YELLOW AnsiCode = "43" BG_BLUE AnsiCode = "44" BG_MAGENTA AnsiCode = "45" BG_CYAN AnsiCode = "46" BG_WHITE AnsiCode = "47" CLR_START AnsiCode = "\033[" CLR_RESET AnsiCode = "\033[0m" CLR_NONE AnsiCode = "" // No format )
type AnsiColorScheme ¶
type AnsiColorScheme struct {
// contains filtered or unexported fields
}
AnsiColorScheme implements ColorScheme for ANSI styles It provides a mapping of log levels to ANSI styles for console output. It allows for easy customization of log output colors using identifiers. The default identifiers used are listed here for reference:
- debug
- info
- warning
- error
- fatal
- deprecate
- deprecate_warning
- deprecate_error
- deprecate_fatal
- deprecate_reason
- lava
- lava_hot
- lava_cold
- lava_dry
- time
- file
- line
- version
- message
- context-key
- context-value
- default (used when no specific style is found)
You may add identifiers as needed for your custom formatters.
func (AnsiColorScheme) GetStyle ¶
func (cs AnsiColorScheme) GetStyle(name string) AnsiStyle
type ColorScheme ¶
type ConsoleColorFormatterBuilder ¶
type ConsoleColorFormatterBuilder struct {
// contains filtered or unexported fields
}
var ConsoleColorFormatter ConsoleColorFormatterBuilder = ConsoleColorFormatterBuilder{ // contains filtered or unexported fields }
func (ConsoleColorFormatterBuilder) AddColor ¶
func (b ConsoleColorFormatterBuilder) AddColor(nameID string, colorCode AnsiStyle) ConsoleColorFormatterBuilder
func (ConsoleColorFormatterBuilder) BaseFormatter ¶
func (b ConsoleColorFormatterBuilder) BaseFormatter(formatter Formatter) ConsoleColorFormatterBuilder
func (ConsoleColorFormatterBuilder) DefaultColor ¶
func (b ConsoleColorFormatterBuilder) DefaultColor(colorCode AnsiStyle) ConsoleColorFormatterBuilder
func (ConsoleColorFormatterBuilder) New ¶
func (b ConsoleColorFormatterBuilder) New() Formatter
func (ConsoleColorFormatterBuilder) Next ¶
func (b ConsoleColorFormatterBuilder) Next(formatter Formatter) FormatterBuilder
type ConsoleWriterBuilder ¶
type ConsoleWriterBuilder struct {
// contains filtered or unexported fields
}
var ConsoleWriter ConsoleWriterBuilder
func (ConsoleWriterBuilder) FormatString ¶
func (b ConsoleWriterBuilder) FormatString(format string) ConsoleWriterBuilder
func (ConsoleWriterBuilder) New ¶
func (b ConsoleWriterBuilder) New() Writer
func (ConsoleWriterBuilder) NewLine ¶
func (b ConsoleWriterBuilder) NewLine() ConsoleWriterBuilder
type FileWriterBuilder ¶
type FileWriterBuilder struct {
// contains filtered or unexported fields
}
var FileWriter FileWriterBuilder
func (FileWriterBuilder) FilePath ¶
func (b FileWriterBuilder) FilePath(path string) FileWriterBuilder
func (FileWriterBuilder) FormatString ¶
func (b FileWriterBuilder) FormatString(format string) FileWriterBuilder
func (FileWriterBuilder) New ¶
func (b FileWriterBuilder) New() Writer
func (FileWriterBuilder) NewLine ¶
func (b FileWriterBuilder) NewLine() FileWriterBuilder
type FormatRecord ¶
type Formatter ¶
type Formatter interface {
Format(original *Record, formatRecord ...*FormatRecord) (string, error)
Next() Formatter
SetNext(next Formatter)
}
Formatter interface defines the methods required for custom formatter implementations. This interface also provides a guide on what chained formatters for a correct interaction between them.
type FormatterBase ¶
type FormatterBase struct {
// contains filtered or unexported fields
}
FormatterBase provides a base implementation for the Formatter interface. It includes common formatting methods and a next formatter for chaining. You can use this as a base for your custom formatters to ensure that they implement the Formatter interface correctly. It is not needed if you want to implement a custom formatter.
> Keep in mind the golang method overriding behavior
func (*FormatterBase) DateFormat ¶
func (f *FormatterBase) DateFormat() string
Returns the date format used to represent the time in the log record. Do not confuse with dateFormatString, which is used to "decorate" the time value in the log record.
func (*FormatterBase) DefaultFormat ¶
func (f *FormatterBase) DefaultFormat() string
func (*FormatterBase) FinalString ¶
func (f *FormatterBase) FinalString(original *Record, formatRecord *FormatRecord) string
func (*FormatterBase) Format ¶
func (f *FormatterBase) Format(r *Record, formatRecord ...*FormatRecord) (string, error)
Since go does not support method overriding the same way as other languages, if you "override" any of the methods in FormatterBase, you must also override the Format method to ensure that the correct methods are used. If you want to keep this behavior, you can simply copy this method and paste it in your custom formatter implementation, this will ensure that the methods called are the ones you defined in your custom formatter.
func (*FormatterBase) Next ¶
func (f *FormatterBase) Next() Formatter
func (*FormatterBase) SetNext ¶
func (f *FormatterBase) SetNext(next Formatter)
type FormatterBuilder ¶
type FormatterBuilder interface {
Next(Formatter) FormatterBuilder
New() Formatter
}
type Record ¶
type WriterBuilder ¶
type WriterBuilder interface {
New() Writer
}