logging

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2018 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ColouredLogger

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

ColouredLogger implements Logger interface with colour support.

func (*ColouredLogger) Println

func (c *ColouredLogger) Println(str string)

Println implements the Println Logger method for ColouredLogger.

func (*ColouredLogger) String

func (c *ColouredLogger) String() string

type ColouredLoggerFactory

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

ColouredLoggerFactory is a factory for the (round robined) creation of coloured loggers. It is inspired by Docker/Moby's libcompose.

func NewColouredLoggerFactory

func NewColouredLoggerFactory() *ColouredLoggerFactory

NewColouredLoggerFactory creates a new ColouredLoggerFactory.

func (*ColouredLoggerFactory) Create

func (c *ColouredLoggerFactory) Create(name string) Logger

Create returns a new ColouredLogger where the colour is selected in a round robin fashion.

type LoggableMessage

type LoggableMessage struct {
	Logger  Logger
	Message map[string]interface{}
}

LoggableMessage models a Graylog message that can be logged to the terminal.

func (*LoggableMessage) Log

func (lm *LoggableMessage) Log(timestamps, utc bool)

Log will log the message to the terminal. The `timestamps` parameter prints timestamps as well as the message. The `utc` parameter can be used to switch to UTC (User local timezone is used otherwise).

type LoggableMessages

type LoggableMessages []*LoggableMessage

LoggableMessages is a slice of LoggableMessage.

func (LoggableMessages) Merge

Merge flattens multiple LoggableMessages into one.

func (LoggableMessages) Sort

Sort arranges the LoggableMessages slice by ascending date.

type Logger

type Logger interface {
	Println(str string)
	String() string
}

Logger defines methods to implement for being a logger.

Jump to

Keyboard shortcuts

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