log

package module
v0.0.0-...-1ac3849 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2019 License: MIT Imports: 10 Imported by: 11

README

log

logging implementation used in godin

Documentation

Index

Constants

View Source
const (
	LevelDebug          = "debug"
	LevelInfo           = "info"
	LevelWarning        = "warning"
	LevelError          = "error"
	MessageKey          = "message"
	EnvironmentVariable = "LOG_LEVEL"
)

Variables

This section is empty.

Functions

func Debug

func Debug(message string, keyvals ...interface{})

func Error

func Error(message string, keyvals ...interface{})

func Info

func Info(message string, keyvals ...interface{})

func NewZapLogger

func NewZapLogger(logLevel string) (*zap.Logger, error)

SetupZapLogger will setup a zap-logger with the given level.

func SetLevel

func SetLevel(level string)

func Warning

func Warning(message string, keyvals ...interface{})

Types

type Log

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

func NewLogger

func NewLogger(logLevel string) Log

NewLogger creates a new, leveled Log. The given level is the allowed minimal level.

func NewLoggerFromEnv

func NewLoggerFromEnv() Log

NewLoggerFromEnv creates a new Log, configuring the log level using an environment variable.

func (Log) Debug

func (l Log) Debug(message string, keyvals ...interface{})

Debug will log a message and arbitrary key-value pairs

func (Log) Error

func (l Log) Error(message string, keyvals ...interface{})

Error will log a message and arbitrary key-value pairs

func (Log) Info

func (l Log) Info(message string, keyvals ...interface{})

Info will log a message and arbitrary key-value pairs

func (Log) Log

func (l Log) Log(keyvals ...interface{})

Log redirects to go-kit/log.Log

func (Log) SetLevel

func (l Log) SetLevel(logLevel string)

func (Log) Warning

func (l Log) Warning(message string, keyvals ...interface{})

Warning will log a message and arbitrary key-value pairs

func (Log) With

func (l Log) With(keyvals ...interface{}) Log

func (Log) WithTrace

func (l Log) WithTrace(ctx context.Context) Log

type Logger

type Logger interface {
	Log(keyvals ...interface{})
	Debug(message string, keyvals ...interface{})
	Info(message string, keyvals ...interface{})
	Warning(message string, keyvals ...interface{})
	Error(message string, keyvals ...interface{})
	With(keyvals ...interface{}) Log
	WithTrace(ctx context.Context) Log
}

Logger is the default logging interface which is used throughout all godin services.

Directories

Path Synopsis
This is a modified version of the go-kit/kit/log/level package to fit godin's need.
This is a modified version of the go-kit/kit/log/level package to fit godin's need.

Jump to

Keyboard shortcuts

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