logger

package module
v0.0.0-...-a0c362a Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MIT Imports: 5 Imported by: 0

README

Logger

A simple initializer around Uber's Zap Logger with a few added helper functions for convenience.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(service string, opts ...loggerOpt) (*zap.SugaredLogger, error)

New constructs a Sugared Logger that writes to stdout and provides human-readable timestamps.

func NewStdLogger

func NewStdLogger(log *zap.SugaredLogger) *log.Logger

func WithGCPMapping

func WithGCPMapping() loggerOpt

WithGCPMapping rewrites the zap config to utilize encoding values to conform to the standards used on Google Cloud logging systems. For more information refer to the following Github Issue/Discussion https://github.com/uber-go/zap/discussions/1110#discussioncomment-2955566

func WithLevel

func WithLevel(level string) loggerOpt

func WithOutputPaths

func WithOutputPaths(outputPaths ...string) loggerOpt

WithOutputPaths overrides the default OutputPaths of os.Stdout. Multiple files, URLs, can also be included in this function. For example: `WithOutputPaths("stdout", "/var/logs/myapp.log")` will print to a file and the standard output

func WithZapConfig

func WithZapConfig(config zap.Config) loggerOpt

WithZapConfig will overwrite the standard configurations provided by `New()` any loggerOpt provided AFTER this function when calling `New()` will continue to modify this provided config.

Types

This section is empty.

Jump to

Keyboard shortcuts

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