logger

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 1 Imported by: 4

Documentation

Overview

DefaultLogger is so simple that it's laughable

The point of this package is to create a layer of abstraction on top of your favorite Go logging library, so that you can use your favorite logging library in Trinkets. A valid Logger implementation needs only 2 methods: * Info(string, ...interface{}) * Error(string, ...interface{})

To enable this you would use:

logger.SetupLogBuilder(func(name string) logger.Logger {
	return your.Logger(name)
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupLogBuilder

func SetupLogBuilder(b LogBuilderType)

SetupLogBuilder helper is used for setting up the log builder function

Types

type Attrs

type Attrs map[string]interface{}

Attrs are used for providing additional info in the log messages

type DefaultLogger added in v0.2.0

type DefaultLogger struct {
	// Name by which the logger is identified
	Name string
}

DefaultLogger is a basic "fmt.print" logger

func (*DefaultLogger) Error added in v0.2.0

func (l *DefaultLogger) Error(msg string, v ...interface{})

Error prints an error message

func (*DefaultLogger) Info added in v0.2.0

func (l *DefaultLogger) Info(msg string, v ...interface{})

Info prints information to the screen

type LogBuilderType added in v0.2.0

type LogBuilderType func(name string) Logger

LogBuilderType function builds new log instances

var NewLogger LogBuilderType

NewLogger builder function

type Logger

type Logger interface {
	Info(string, ...interface{})
	Error(string, ...interface{})
}

Logger types must support Info and Error functions

Jump to

Keyboard shortcuts

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