log

package
v0.14.21 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DebugLevel = zapcore.DebugLevel
	InfoLevel  = zapcore.InfoLevel
	WarnLevel  = zapcore.WarnLevel
	ErrorLevel = zapcore.ErrorLevel
	FatalLevel = zapcore.FatalLevel
)

Variables

View Source
var (
	DefaultLogger *ronyLogger
	NopLogger     *ronyLogger
)
View Source
var DefaultConfig = Config{
	Level:           InfoLevel,
	DirPath:         ".",
	SentryDSN:       "",
	SentryLevel:     WarnLevel,
	Release:         "",
	Environment:     "",
	SkipCaller:      1,
	TimeEncoder:     timeEncoder,
	LevelEncoder:    zapcore.CapitalLevelEncoder,
	DurationEncoder: zapcore.StringDurationEncoder,
	CallerEncoder:   zapcore.ShortCallerEncoder,
}

Functions

func New

func New(cfg Config) *ronyLogger

func NewSentryCore

func NewSentryCore(sentryDSN, release, environment string, level zapcore.Level, tags map[string]string) zapcore.Core

func NewSyslogCore added in v0.14.20

func NewSyslogCore(levelEnabler zapcore.LevelEnabler, encoder zapcore.Encoder, tag string) (*syslogCore, error)

func ProvideDI added in v0.12.49

func ProvideDI(cfg Config)

ProvideDI is protected by sync.Once and provides the Logger interface for other packages.

func SetLevel

func SetLevel(level Level)

Types

type CallerEncode added in v0.12.44

type CallerEncode = zapcore.CallerEncoder

type CheckedEntry

type CheckedEntry = zapcore.CheckedEntry

type Config

type Config struct {
	Level           Level
	DirPath         string
	SentryDSN       string
	SentryLevel     Level
	Release         string
	Environment     string
	SkipCaller      int
	TimeEncoder     TimeEncoder
	LevelEncoder    LevelEncoder
	DurationEncoder DurationEncoder
	CallerEncoder   CallerEncode
	SyslogTag       string
}

type DurationEncoder added in v0.12.44

type DurationEncoder = zapcore.DurationEncoder

type Field

type Field = zapcore.Field

type FieldType

type FieldType = zapcore.FieldType

type Level

type Level = zapcore.Level

type LevelEncoder added in v0.12.44

type LevelEncoder = zapcore.LevelEncoder

type Logger

type Logger interface {
	Debug(msg string, fields ...Field)
	Info(msg string, fields ...Field)
	Warn(msg string, fields ...Field)
	Error(msg string, fields ...Field)
	Fatal(msg string, fields ...Field)
	Check(Level, string) *CheckedEntry
	Sugared() *sugaredRonyLogger
	SetLevel(level Level)
	With(name string) Logger
}

func With added in v0.12.48

func With(name string) Logger

type SugaredLogger

type SugaredLogger interface {
	Debugf(template string, args ...interface{})
	Infof(template string, args ...interface{})
	Printf(template string, args ...interface{})
	Warnf(template string, args ...interface{})
	Errorf(template string, args ...interface{})
	Fatalf(template string, args ...interface{})
	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})
}

type TimeEncoder added in v0.12.44

type TimeEncoder = zapcore.TimeEncoder

Jump to

Keyboard shortcuts

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