l

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2019 License: MIT Imports: 4 Imported by: 11

README

l Build Status Coverage Status Go Report Card

A simple log wrapper for zap

dependencies

tools (you must provide the installation)

libraries

tests and coverage

  • run unit tests: make docker.test
  • run coverage: make docker.coverage.text
  • run html coverage: make docker.coverage.html

l usage

Find some samples in the test file a better usage section will be avaiable soon ...

Documentation

Index

Constants

View Source
const (
	//STDOUT any message to stdout
	STDOUT Out = "stdout"
	//STDERR redirects any message to stderr
	STDERR Out = "stderr"

	//ERROR is the error level logger
	ERROR Level = "error"
	//INFO is the info level logger
	INFO Level = "info"
	//DEBUG is the debug level logger
	DEBUG Level = "debug"
)

Variables

View Source
var LoggerDefault = NewZapLoggerDefault()

LoggerDefault is the back-end implementation used on the log package level functions

Functions

func Debug

func Debug(ctx context.Context, msg string, values ...Value)

func Error

func Error(ctx context.Context, msg string, values ...Value)

func Info

func Info(ctx context.Context, msg string, values ...Value)

func NewDriver

func NewDriver(logger zapLogger) zapDriver

func NewZapLogger

func NewZapLogger(level Level, output Out) (*zap.Logger, error)

func SetLoggerDefault

func SetLoggerDefault(logger Logger) error

Types

type Driver

type Driver interface {
	Log(Level, string) LogWriter
	Close()
}

type Level

type Level string

Level is the threshold of the logger

func (*Level) Set

func (l *Level) Set(value string) error

Set is a utility method for flag system usage

func (Level) String

func (l Level) String() string

String returns a lower-case ASCII representation of the log level.

type LogWriter

type LogWriter interface {
	Write(...Value)
}

type Logger

type Logger interface {
	Debug(context.Context, string, ...Value)
	Info(context.Context, string, ...Value)
	Error(context.Context, string, ...Value)
}

func New

func New(driver Driver) Logger

func NewZapLoggerDefault

func NewZapLoggerDefault() Logger

type Out

type Out string

Out is the type for logger writer config

func (*Out) Set

func (o *Out) Set(value string) error

Set is a utility method for flag system usage

func (Out) String

func (o Out) String() string

type Value

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

func NewValue

func NewValue(name string, value interface{}) Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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