logger

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package logger wraps some commonly used functions from zap.Logger and zap.SugaredLogger and maintains a single instance of the logger

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHook

func AddHook(hook func(zapcore.Entry) error)

AddHook adds func(zapcore.Entry) error) to the logger lifecycle

func Debug

func Debug(message string, fields ...zap.Field)

Debug logs the message at debug level with additional fields, if any

func Debugf

func Debugf(template string, args ...interface{})

Debugf allows Sprintf style formatting and logs at debug level

func Error

func Error(message string, fields ...zap.Field)

Error logs the message at error level and prints stacktrace with additional fields, if any

func Errorf

func Errorf(template string, args ...interface{})

Errorf allows Sprintf style formatting, logs at error level and prints stacktrace

func Fatal

func Fatal(message string, fields ...zap.Field)

Fatal logs the message at fatal level with additional fields, if any and exits

func Fatalf

func Fatalf(template string, args ...interface{})

Fatalf allows Sprintf style formatting, logs at fatal level and exits

func Info

func Info(message string, fields ...zap.Field)

Info logs the message at info level with additional fields, if any

func Infof

func Infof(template string, args ...interface{})

Infof allows Sprintf style formatting and logs at info level

func SugaredWithRequest

func SugaredWithRequest(r *http.Request) *zap.SugaredLogger

SugaredWithRequest takes in a http.Request and logs the message with request's Method, Host and Path and returns zap.SugaredLogger to support Sprintf styled logging

func Warn

func Warn(message string, fields ...zap.Field)

Warn logs the message at warn level with additional fields, if any

func Warnf

func Warnf(template string, args ...interface{})

Warnf allows Sprintf style formatting and logs at warn level

func WithRequest

func WithRequest(r *http.Request) *zap.Logger

WithRequest takes in a http.Request and logs the message with request's Method, Host and Path and returns zap.logger

Types

This section is empty.

Jump to

Keyboard shortcuts

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