Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Cause ¶
Cause returns the underlying cause of the error, if possible. An error value has a cause if it implements the following interface:
type causer interface {
Cause() error
}
If the error does not implement Cause, the original error will be returned. If the error is nil, nil will be returned without further investigation.
DEPRECATED: Use logan/v3 instead
func FromPanic ¶
func FromPanic(rec interface{}) error
FromPanic extracts the err from the result of a recover() call.
DEPRECATED: Use logan/v3 instead
Types ¶
type F ¶
type F map[string]interface{}
F type is for fields, connected to `withFields` error.
DEPRECATED: Use logan/v3 instead
func GetFields ¶
GetFields returns the underlying fields of the error and its nested cause-errors, if possible. An error value has fields if it (or any of its nested cause) implements the following interface:
type fieldsProvider interface {
GetFields() F
}
If the error and all of its nested causes do not implement GetFields, empty fields map will be returned.
DEPRECATED: Use logan/v3 instead
func WithField ¶
WithField creates new `F` fields map and add provided key-value pair into it using Add method.
DEPRECATED: Use logan/v3 instead
func (F) Add ¶
Add tries to extract fields from `value`, if `value` implements fields.Provider interface:
type Provider interface {
GetLoganFields() map[string]interface{}
}
And adds these fields using AddFields. If `value` does not implement Provider - a single key-value pair is added.
DEPRECATED: Use logan/v3 instead
func (F) AddFields ¶
AddFields returns `F` map, which contains key-values from both maps. If both maps has some key - the value from the `newF` will be used.
DEPRECATED: Use logan/v3 instead