logmatic

package module
v0.0.0-...-d43b0f3 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2019 License: MIT Imports: 4 Imported by: 0

README

GoDoc Build Status Go Report Card codecov

logmatic

Colorized logger for Golang with dynamic log level configuration

Documentation here: https://godoc.org/github.com/borderstech/logmatic

Example Usage

l := logmatic.NewLogger()
l.SetLevel(logmatic.DEBUG)

l.Trace("This will not display")
l.Debug("Something happened")
l.Info("Here is some information")
l.Warn("Do not do that")
l.Error("Something bad happened...")

l.SetLevel(logmatic.TRACE)
l.Trace("Now this will display")

l.Fatal("The application will now exit")

Example results

Documentation

Index

Constants

View Source
const (
	TRACE = iota
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
)

Log levels

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLevel

type LogLevel uint8

LogLevel controls what log statements are activated for a given logger

type Logger

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

Logger maintains a set of logging functions and has a log level that can be modified dynamically

func NewLogger

func NewLogger() *Logger

NewLogger creates a new logger Default level is INFO

func (*Logger) Debug

func (l *Logger) Debug(format string, a ...interface{})

Debug logs a debug statement DEBUG or lower

func (*Logger) Error

func (l *Logger) Error(format string, a ...interface{})

Error logs an error statement ERROR or lower (any level)

func (*Logger) Fatal

func (l *Logger) Fatal(format string, a ...interface{})

Fatal logs an error statement and exits the application FATAL or lower (any level)

func (*Logger) Info

func (l *Logger) Info(format string, a ...interface{})

Info logs an info statement INFO or lower

func (*Logger) SetLevel

func (l *Logger) SetLevel(level LogLevel)

SetLevel updates the logging level for future logs

func (*Logger) Trace

func (l *Logger) Trace(format string, a ...interface{})

Trace logs a trace statement TRACE only

func (*Logger) Warn

func (l *Logger) Warn(format string, a ...interface{})

Warn logs a warn statement WARN or lower

Jump to

Keyboard shortcuts

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