mehlog

package
v1.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 4 Imported by: 30

Documentation

Overview

Package mehlog allows logging of meh.Error to zap.Logger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Log

func Log(logger *zap.Logger, err error)

Log the given error using the default level translator that can be set via SetDefaultLevelTranslator.

func LogToLevel

func LogToLevel(logger *zap.Logger, level zapcore.Level, err error)

LogToLevel logs the given error to the given zapcore.Level.

func OmitErrorMessageField added in v1.11.0

func OmitErrorMessageField(omit bool)

OmitErrorMessageField sets whether the error message field with key meh.MapFieldErrorMessage should be omitted in logs and only output as log message in order to improve human readability.

func SetDefaultLevelTranslator

func SetDefaultLevelTranslator(lt LevelTranslator)

SetDefaultLevelTranslator sets the LevelTranslator to be used for regular Log-calls.

func WrapAndLog

func WrapAndLog(logger *zap.Logger, err error, message string)

WrapAndLog calls Log after meh.Wrap with the given error and message.

Types

type LevelTranslator

type LevelTranslator func(code meh.Code) zapcore.Level

LevelTranslator translates the given meh.Code to zapcore.Level for logging.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL