log

package module
v0.0.0-...-5535e23 Latest Latest
Warning

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

Go to latest
Published: May 13, 2023 License: MIT Imports: 6 Imported by: 3

Documentation

Overview

Package log to define custom logger

Index

Constants

This section is empty.

Variables

View Source
var DefaultOptions = &Options{
	Debug:    true,
	LogLevel: "info",
}

DefaultOptions define default options

Functions

func SetLogger

func SetLogger(instance Store)

SetLogger defines the default package logger

func Setup

func Setup(ctx context.Context, opts *Options)

Setup our logger

Types

type Logger

type Logger interface {
	Debug(msg string, fields ...zapcore.Field)
	Info(msg string, fields ...zapcore.Field)
	Warn(msg string, fields ...zapcore.Field)
	Error(msg string, fields ...zapcore.Field)
	Fatal(msg string, fields ...zapcore.Field)
	Panic(msg string, fields ...zapcore.Field)
}

Logger defines all the available levels

func Bg

func Bg() Logger

Bg delegates a no-context logger

func For

func For(ctx context.Context) Logger

For delegates a context logger

type Options

type Options struct {
	Debug    bool
	LogLevel string
}

Options defines the options available for the logger

type Store

type Store interface {
	Bg() Logger
	For(context.Context) Logger
}

Store define the default store of the logger

func Default

func Default() Store

Default returns the logger factory

func NewStore

func NewStore(logger *zap.Logger) Store

NewStore creates a new instance of a Store

Jump to

Keyboard shortcuts

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