logutil

package
v0.0.0-...-3975a26 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package logutil provides helper functions for more convenient logging and error tracking.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Critical

func Critical(log zerolog.Logger, err error) *zerolog.Event

Critical creates an error level log event and sends the error to the remote error tracking service.

func Recover

func Recover(log zerolog.Logger, msg string, extra map[string]interface{}, fn func())

Recover handles recoveries from panics, sends their info to the remote error tracking service and logs them locally. If no panic occurs, nothing will be logged / sent. Map parameter provides additional key-value pairs to include in the log entry (not the remote error tracking event). It can be nil. Function type parameter is called right before message printing. It can be nil. Example: `defer logutil.Recover(log, "cannot continue", map[string]interface{"request_id": "id123"}, cleanupFn)`. or `defer logutil.Recover(log, "cannot continue", nil, nil)`.

Types

This section is empty.

Jump to

Keyboard shortcuts

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