loggerzap

package
v0.0.0-...-0a4f32b Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package loggerzap is a thin wrapper around go.uber.org/zap that implements logger.Logger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) logger.Logger

New creates a go.uber.org/zap instance

Types

type Config

type Config struct {
	Env        logger.Environment
	Level      logger.Level
	Encoding   Encoding
	MessageKey string
}

Config data

func NewDevConfig

func NewDevConfig() Config

NewDevConfig creates a reasonable development config

func NewProdConfig

func NewProdConfig() Config

NewProdConfig creates a reasonable production config

func (Config) GetEnvironment

func (c Config) GetEnvironment() logger.Environment

func (Config) GetLevel

func (c Config) GetLevel() logger.Level

type Encoding

type Encoding string

Encoding enum

const (
	Console Encoding = "console"
	Json    Encoding = "json"
)

func (Encoding) String

func (e Encoding) String() string

type ZapLogger

type ZapLogger struct {
	// contains filtered or unexported fields
}

ZapLogger is the Logger implementation using zap

func (ZapLogger) Debug

func (z ZapLogger) Debug(msg string)

func (ZapLogger) Debugf

func (z ZapLogger) Debugf(format string, a any)

func (ZapLogger) Error

func (z ZapLogger) Error(msg string)

func (ZapLogger) Errorf

func (z ZapLogger) Errorf(format string, a any)

func (ZapLogger) Fatal

func (z ZapLogger) Fatal(msg string)

func (ZapLogger) Fatalf

func (z ZapLogger) Fatalf(format string, a any)

func (ZapLogger) GetLevel

func (z ZapLogger) GetLevel() logger.Level

func (ZapLogger) Info

func (z ZapLogger) Info(msg string)

func (ZapLogger) Infof

func (z ZapLogger) Infof(format string, a any)

func (ZapLogger) Panic

func (z ZapLogger) Panic(msg string)

func (ZapLogger) Panicf

func (z ZapLogger) Panicf(format string, a any)

func (ZapLogger) Sync

func (z ZapLogger) Sync()

func (ZapLogger) Warn

func (z ZapLogger) Warn(msg string)

func (ZapLogger) Warnf

func (z ZapLogger) Warnf(format string, a any)

func (ZapLogger) WithField

func (z ZapLogger) WithField(key string, val any) logger.Logger

Jump to

Keyboard shortcuts

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