Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallerInfo ¶
Stores the information on the caller, getting the last frame. The File is the full path of the file that called the error and Line is the line number that the error was added from
type ErrorCollector ¶
type ErrorCollector struct {
// contains filtered or unexported fields
}
An error collector that stores a list of errors
func NewErrorCollector ¶
func NewErrorCollector(callerInfo bool) *ErrorCollector
Creates a new error collector If callerInfo is set to true, the file and line information of where an error was called is stored with an error
func (*ErrorCollector) Add ¶
func (e *ErrorCollector) Add(err error, severity zerolog.Level, expected bool, fields map[string]any, message string)
Add an error to the error collector
func (*ErrorCollector) ApplyToEvent ¶
func (e *ErrorCollector) ApplyToEvent(event *zerolog.Event) *zerolog.Event
Applies all of the errors to a given zerolog event, setting them all to the errors field
func (*ErrorCollector) HasErrors ¶
func (e *ErrorCollector) HasErrors() bool
Checks if the error collector has any errors and returns true if so
func (*ErrorCollector) HighestSeverity ¶
func (e *ErrorCollector) HighestSeverity() ErrorInfo
Returns the highest severity error that the error collector has. If there are multiple of the same severity it will return the last one added
type ErrorInfo ¶
type ErrorInfo struct {
Error string `json:"error"`
Severity zerolog.Level `json:"severity"`
Expected bool `json:"expected"`
Fields map[string]any `json:"fields,omitempty"`
Message string `json:"message"`
CallerInfo CallerInfo `json:"caller_info"`
}
Stores information about an error