Documentation ¶
Index ¶
- Constants
- Variables
- func BracketValue(w io.Writer, key string, value interface{}, needsQuoting func(string) bool)
- func KeyValue(w io.Writer, key string, value interface{}, needsQuoting func(string) bool)
- func LevelValue(w io.Writer, key string, value interface{}, needsQuoting func(string) bool)
- func PaddedFieldFormatter(formatter FieldFormatter) ...
- func PlainValue(w io.Writer, key string, value interface{}, needsQuoting func(string) bool)
- type Entry
- type FieldFormatter
- type FieldFormatters
- type FieldMap
- type Fields
- type JSONFormatter
- type TextFmtFormatter
- type TextFormatter
Constants ¶
View Source
const ( TraceLevel = logrus.TraceLevel DebugLevel = logrus.DebugLevel InfoLevel = logrus.InfoLevel WarnLevel = logrus.WarnLevel ErrorLevel = logrus.ErrorLevel FatalLevel = logrus.FatalLevel PanicLevel = logrus.PanicLevel )
View Source
const FieldKeyFile = logrus.FieldKeyFile
View Source
const FieldKeyFunc = logrus.FieldKeyFunc
View Source
const FieldKeyLevel = logrus.FieldKeyLevel
View Source
const FieldKeyLogrusError = logrus.FieldKeyLogrusError
View Source
const FieldKeyMsg = logrus.FieldKeyMsg
View Source
const FieldKeyTime = logrus.FieldKeyTime
Variables ¶
View Source
var AllLevels = logrus.AllLevels
Functions ¶
func BracketValue ¶
func LevelValue ¶
func PaddedFieldFormatter ¶
func PaddedFieldFormatter(formatter FieldFormatter) func(w io.Writer, key string, value interface{}, needsQuoting func(string) bool)
PaddedFieldFormatter returns a field formatter, which incrementally aligns the value of a given field formatter. It keeps track of the maximum field length known from the previous calls and pads new values accordingly.
Types ¶
type FieldFormatter ¶
type FieldFormatters ¶
type FieldFormatters map[string]FieldFormatter
type FieldMap ¶
type FieldMap map[fieldKey]string
FieldMap allows customization of the key names for default fields.
type JSONFormatter ¶
type JSONFormatter struct { // TimestampFormat sets the format used for marshaling timestamps. // The format to use is the same than for time.Format or time.Parse from the standard // library. // The standard Library already provides a set of predefined format. TimestampFormat string // DisableTimestamp allows disabling automatic timestamps in output DisableTimestamp bool // DisableHTMLEscape allows disabling html escaping in output DisableHTMLEscape bool // DataKey allows users to put all the log entry parameters into a nested dictionary at a given key. DataKey string // FieldMap allows users to customize the names of keys for default fields. // As an example: // formatter := &JSONFormatter{ // FieldMap: FieldMap{ // FieldKeyTime: "@timestamp", // FieldKeyLevel: "@level", // FieldKeyMsg: "@message", // FieldKeyFunc: "@caller", // }, // } FieldMap FieldMap // FixedFields can be used to definen a fixed order for dedicated fields. // They will be rendered before other fields. // If defined, the standard field keys should be added, also. // The default order is: FieldKeyTime, FieldKeyLevel, FieldKeyMsg, // FieldKeyFunc, FieldKeyFile. FixedFields []string // CallerPrettyfier can be set by the user to modify the content // of the function and file keys in the json data when ReportCaller is // activated. If any of the returned value is the empty string the // corresponding key will be removed from json fields. CallerPrettyfier func(*runtime.Frame) (function string, file string) // PrettyPrint will indent all json logs PrettyPrint bool }
JSONFormatter formats logs into parsable json
type TextFmtFormatter ¶
type TextFmtFormatter struct {
TextFormatter
}
type TextFormatter ¶
type TextFormatter struct { // Set to true to bypass checking for a TTY before outputting colors. ForceColors bool // Force disabling colors. DisableColors bool // Force quoting of all values ForceQuote bool // DisableQuote disables quoting for all values. // DisableQuote will have a lower priority than ForceQuote. // If both of them are set to true, quote will be forced on all values. DisableQuote bool // Override coloring based on CLICOLOR and CLICOLOR_FORCE. - https://bixense.com/clicolors/ EnvironmentOverrideColors bool // Disable timestamp logging. useful when output is redirected to logging // system that already adds timestamps. DisableTimestamp bool // Enable logging the full timestamp when a TTY is attached instead of just // the time passed since beginning of execution. FullTimestamp bool // TimestampFormat to use for display when a full timestamp is printed. // The format to use is the same than for time.Format or time.Parse from the standard // library. // The standard Library already provides a set of predefined format. TimestampFormat string // The fields are sorted by default for a consistent output. For applications // that log extremely frequently and don't use the JSON formatter this may not // be desired. DisableSorting bool // The keys sorting function, when uninitialized it uses sort.Strings. SortingFunc func([]string) // Disables the truncation of the level text to 4 characters. DisableLevelTruncation bool // PadLevelText Adds padding the level text so that all the levels output at the same length // PadLevelText is a superset of the DisableLevelTruncation option PadLevelText bool // QuoteEmptyFields will wrap empty fields in quotes if true QuoteEmptyFields bool // FieldMap allows users to customize the names of keys for default fields. // As an example: // formatter := &TextFormatter{ // FieldMap: FieldMap{ // FieldKeyTime: "@timestamp", // FieldKeyLevel: "@level", // FieldKeyMsg: "@message"}} FieldMap FieldMap // FixedFields can be used to definen a fixed order for dedicated fields. // They will be rendered before other fields. // If defined, the standard field keys should be added, also. // The default order is: FieldKeyTime, FieldKeyLevel, FieldKeyMsg, // FieldKeyFunc, FieldKeyFile. FixedFields []string // FieldFormatters are used render a key/value pair. // The default formatter is KeyValue. FieldFormatters FieldFormatters // PaddedFixedFields specified the number of // fixed fields, which should be incrementally padded // by observing the field length of the previous log entries. PaddedFixedFields int // CallerPrettyfier can be set by the user to modify the content // of the function and file keys in the data when ReportCaller is // activated. If any of the returned value is the empty string the // corresponding key will be removed from fields. CallerPrettyfier func(*runtime.Frame) (function string, file string) // contains filtered or unexported fields }
TextFormatter formats logs into text
Click to show internal directories.
Click to hide internal directories.