Documentation
¶
Index ¶
- type Caller
- type Formatter
- func (f *Formatter) AddCallDepth(depth int)
- func (f *Formatter) AddContext(ctx context.Context)
- func (f *Formatter) AddName(name string)
- func (f *Formatter) AddValues(kvList []interface{})
- func (f Formatter) FormatError(err error, msg string, kvList []interface{}) *lpb.LogRecord
- func (f Formatter) FormatInfo(level int, msg string, kvList []interface{}) *lpb.LogRecord
- func (f Formatter) FormatResource(res *resource.Resource) (string, *rpb.Resource)
- func (f Formatter) FormatScope(s instrumentation.Scope) (string, *cpb.InstrumentationScope)
- func (f *Formatter) Init(info logr.RuntimeInfo)
- type MessageClass
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Caller ¶
type Caller struct { // File is the basename of the file for this call site. File string `json:"file"` // Line is the line number in the file for this call site. Line int `json:"line"` // Func is the function name for this call site, or empty if // Options.LogCallerFunc is not enabled. Func string `json:"function,omitempty"` }
Caller represents the original call site for a log line, after considering logr.Logger.WithCallDepth and logr.Logger.WithCallStackHelper. The File and Line fields will always be provided, while the Func field is optional.
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
func NewFormatter ¶
NewFormatter returns a constructed Formatter.
func (*Formatter) AddCallDepth ¶
AddCallDepth increases the number of stack-frames to skip when attributing the log line to a file and line.
func (*Formatter) AddContext ¶
AddContext adds log values for the span in ctx if it exists.
func (Formatter) FormatError ¶
func (Formatter) FormatInfo ¶
func (Formatter) FormatResource ¶
func (Formatter) FormatScope ¶
func (f Formatter) FormatScope(s instrumentation.Scope) (string, *cpb.InstrumentationScope)
func (*Formatter) Init ¶
func (f *Formatter) Init(info logr.RuntimeInfo)
Init configures this Formatter from runtime info, such as the call depth imposed by logr itself.
type MessageClass ¶
type MessageClass int
MessageClass indicates which category or categories of messages to consider.
const ( // None ignores all message classes. None MessageClass = iota // All considers all message classes. All // Info only considers info messages. Info // Error only considers error messages. Error )
type Options ¶
type Options struct { // LogCaller defines when to add a "caller" key to some or all log lines. // This has some overhead, so some users might not want it. LogCaller MessageClass // LogCallerFunc defines if the calling function name shoule be logged. // This has no effect if caller logging is not enabled (see // Options.LogCaller). LogCallerFunc bool // MaxLogDepth defines how many levels of nested fields (e.g. a struct that // contains a struct, etc.) to log. If this field is not specified, a // default value, 16, will be used. MaxLogDepth int }
Click to show internal directories.
Click to hide internal directories.