Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogErrorWithOptionalContext ¶
LogErrorWithOptionalContext logs an error, optionally adding context to the logger iff the error implements the LogContextualizer interface.
func WrapErrorWithSourceModuleContext ¶
WrapErrorWithPricesSourceModuleContext wraps an error with a LogContextualizer that the spercified source module. This is useful for logging the error within the process proposal handler (or any other location that uses LogErrorWithOptionalContext) with metadata that can be used to identify the source of the error.
Types ¶
type ErrorWithLogContext ¶
type ErrorWithLogContext struct { LogContextualizer // contains filtered or unexported fields }
ErrorWithLogContext wraps an error with log context and implements the LogContextualizer interface. ErrorWithLogContext unwraps to the original error.
func NewErrorWithLogContext ¶
func NewErrorWithLogContext(err error) *ErrorWithLogContext
NewErrorWithLogContext returns a new ErrorWithLogContext wrapping the given error.
func (*ErrorWithLogContext) AddLoggingContext ¶
func (ewlc *ErrorWithLogContext) AddLoggingContext(logger log.Logger) log.Logger
AddLoggingContext returns a modified logger with the error's logging context added.
func (*ErrorWithLogContext) Error ¶
func (ewlc *ErrorWithLogContext) Error() string
Error returns the underlying error's Error() string.
func (*ErrorWithLogContext) Unwrap ¶
func (ewlc *ErrorWithLogContext) Unwrap() error
Unwrap returns the underlying error.
func (*ErrorWithLogContext) WithLogKeyValue ¶
func (ewlc *ErrorWithLogContext) WithLogKeyValue(key interface{}, value interface{}) *ErrorWithLogContext
WithLogKeyValue adds a key-value pair to the error's log context. The returned ErrorWithLogContext is the same error.