log

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 3 Imported by: 14

Documentation

Overview

Package log implements interfaces and helpers for logging.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Null is the null Logger instance.
	Null = &nullLogger{}
)

Functions

func Debug

func Debug(lable Loggable, msg string, pairs ...interface{})

Debug logs a debug message.

func Error

func Error(lable Loggable, msg string, pairs ...interface{})

Error logs an error message.

func Fatal

func Fatal(lable Loggable, msg interface{}, pairs ...interface{})

Fatal is equivalent to Error() followed by a call to os.Exit(1).

Fatal will attempt to call Close() on the logger.

func Info

func Info(lable Loggable, msg string, pairs ...interface{})

Info logs an informational message.

Types

type Loggable

type Loggable interface {
	Logger() Logger
}

Loggable represents an object that has a Logger.

type Logger

type Logger interface {
	// Debug logs a debug message.
	Debug(msg string, ctx ...interface{})
	// Info logs an informational message.
	Info(msg string, ctx ...interface{})
	// Error logs an error message.
	Error(msg string, ctx ...interface{})
}

Logger represents an abstract logging object.

type MockLoggable

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

MockLoggable implements the Loggable interface.

func NewMockLoggable

func NewMockLoggable(l Logger) *MockLoggable

NewMockLoggable creates a new MockLoggable.

func (*MockLoggable) Logger

func (m *MockLoggable) Logger() Logger

Logger implements the Loggable interface.

Jump to

Keyboard shortcuts

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