Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LogtraceHook ¶
type LogtraceHook struct {
// The key (for the field in the logrus entry) to use for the stacktrace
Key string
// The log levels this hook should be fired for
LogLevels []logrus.Level
// Whether to capture a new stacktrace for errors without a stacktrace
//
// The captures tacktrace corresponds to the call of the log function, not the actual origin of the error
// However, this may still help in identifying the path
CaptureStackIfMissing bool
}
LogtraceHook is a logrus hook that attaches a stacktrace to log entries with errors
func DefaultLogtraceHook ¶
func DefaultLogtraceHook() LogtraceHook
DefaultLogtraceHook returns the default LogtraceHook
It has the following properties - The key is "stacktrace" - The hook runs on all log levels - For errors without a stacktrace a new stacktrace is captured corresponding to the call of the log function
func (LogtraceHook) Fire ¶
func (hook LogtraceHook) Fire(entry *logrus.Entry) error
Fire is called by logrus when to hook is supposed to run
func (LogtraceHook) Levels ¶
func (hook LogtraceHook) Levels() []logrus.Level
type StackFrame ¶
type StackFrame struct {
// File is the path to the file containing the instruction of the StackFrame
File string
// The Line of the instruction of the StackFrame
Line int
// The Function of the instruction of the StackFrame
Function string
// The Package that contains the Function
Package string
}
A StackFrame represents one frame in a stacktrace
Click to show internal directories.
Click to hide internal directories.