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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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