logging

package
v0.0.0-...-97b9ebb Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package logging contains degitx logging API, mapping and configuring internal implementation. zap is current implementation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(node *locators.Node, cfg *LogConfig)

Init inits zap logger context from config and predeclared settings. Init also adds node ID to logger context

func InitNodeless

func InitNodeless(cfg *LogConfig)

InitNodeless inits zap logger context from config and predeclared settings

Types

type LogConfig

type LogConfig struct {
	Outputs   []Output `yaml:"outputs"`
	ErrorsOut []string `yaml:"errors"`
}

LogConfig is a log configuration

func (*LogConfig) FromFile

func (config *LogConfig) FromFile(fileName string) error

FromFile parses yaml file

type LogLevel

type LogLevel int8

LogLevel that is supported with current API

const (
	Debug LogLevel = iota
	Info
	Warn
	Error
)

Supported log levels

func (LogLevel) String

func (i LogLevel) String() string

type Logger

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

Logger is a struct that encapsulates logger implementation

func NewLogger

func NewLogger(tag string) (*Logger, error)

NewLogger creates new Logger

func (*Logger) Debug

func (log *Logger) Debug(template string)

Debug level log

func (*Logger) Debugf

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

Debugf Printf-like debug level log

func (*Logger) Error

func (log *Logger) Error(template string)

Error level log

func (*Logger) Errorf

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

Errorf Printf-like error level log

func (*Logger) Info

func (log *Logger) Info(template string)

Info level log

func (*Logger) Infof

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

Infof Printf-like info level log

func (*Logger) Warn

func (log *Logger) Warn(template string)

Warn level log

func (*Logger) Warnf

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

Warnf Printf-like warn level log

type Output

type Output struct {
	Path   []string `yaml:"path"`
	Level  string   `yaml:"level"`
	Format string   `yaml:"format"`
}

Output is a log settings: where to write logs, on which level and how to format them

Jump to

Keyboard shortcuts

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