glug

package
v0.0.0-...-add2d34 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2018 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

package glug provides a logging framework for modular applications

Construct a `Logger` by calling `MakeLogger` once per package, then use that logger throughout that package. You can set individual logging levels per package by calling `SetLoggerLevel("PackageName",LevelDebug)`. To enable `Debug` and `Trace` levels you must compile with `-tags debug` or the calls are empty.

Index

Constants

View Source
const (
	// Inside loops
	LevelTrace = -8
	// Packets
	LevelDebug = 0
	// Connections, disconnects, normal operation
	LevelInfo = 8
	// Interesting config values
	LevelWeird = 16
	// Unreachable, Unable to open config
	LevelError = 24
)

Variables

This section is empty.

Functions

func Chain

func Chain(err error, cause error) error

func Combine

func Combine(errs []error) error

func SetLoggerLevel

func SetLoggerLevel(name string, level int) bool

func Wrap

func Wrap(err error, reason string) error

func Wrapf

func Wrapf(err error, format string, args ...interface{}) error

Types

type ChainError

type ChainError []error

func (ChainError) Error

func (c ChainError) Error() string

func (ChainError) String

func (c ChainError) String() string

type KV

type KV map[string]interface{}

type Logger

type Logger struct {
	Name  string
	Level int
}

func NewLogger

func NewLogger(name string) *Logger

func (*Logger) Debug

func (l *Logger) Debug(args ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(fmt string, args ...interface{})

func (*Logger) Error

func (l *Logger) Error(args ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(fmt string, args ...interface{})

func (*Logger) Info

func (l *Logger) Info(args ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(fmt string, args ...interface{})

func (*Logger) Log

func (l *Logger) Log(level int, args ...interface{})

func (*Logger) Logf

func (l *Logger) Logf(level int, format string, args ...interface{})

func (*Logger) Trace

func (l *Logger) Trace(args ...interface{})

func (*Logger) Tracef

func (l *Logger) Tracef(fmt string, args ...interface{})

func (*Logger) Weird

func (l *Logger) Weird(args ...interface{})

func (*Logger) Weirdf

func (l *Logger) Weirdf(fmt string, args ...interface{})

type MultiError

type MultiError []error

func (MultiError) Error

func (m MultiError) Error() string

func (MultiError) String

func (m MultiError) String() string

type WrappedError

type WrappedError struct {
	Wrap string
	Err  error
}

func (WrappedError) Error

func (e WrappedError) Error() string

func (WrappedError) String

func (e WrappedError) String() string

Jump to

Keyboard shortcuts

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