logging

package
v0.0.0-...-a216e23 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2016 License: Apache-2.0 Imports: 5 Imported by: 4

Documentation

Overview

Package logging provides logging.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Name determines the name of the logger.
	Name string
	// Level determines the level of the logger.
	LogLevel string
	// Color determines whether logs are printed with color, where supported.
	Color bool
}

Config provides a configuration for loggers.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns a Config set by best effort.

type GoLoggingLogger

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

GoLoggingLogger is a Logger based on the go-logging library.

func NewGoLoggingLogger

func NewGoLoggingLogger(config Config) GoLoggingLogger

NewGoLoggingLogger returns a GoLoggingLogger, given a Config.

func (GoLoggingLogger) Critical

func (gll GoLoggingLogger) Critical(ctx context.Context, f string, v ...interface{})

Critical logs on the Critical level.

func (GoLoggingLogger) Debug

func (gll GoLoggingLogger) Debug(ctx context.Context, f string, v ...interface{})

Debug logs on the Debug level.

func (GoLoggingLogger) Error

func (gll GoLoggingLogger) Error(ctx context.Context, f string, v ...interface{})

Error logs on the Error level.

func (GoLoggingLogger) Info

func (gll GoLoggingLogger) Info(ctx context.Context, f string, v ...interface{})

Info logs on the Info level.

func (GoLoggingLogger) Notice

func (gll GoLoggingLogger) Notice(ctx context.Context, f string, v ...interface{})

Notice logs on the Notice level.

func (GoLoggingLogger) Warning

func (gll GoLoggingLogger) Warning(ctx context.Context, f string, v ...interface{})

Warning logs on the Warning level.

type Logger

type Logger interface {
	// Debug is for logging information pertinent to development and testing.
	Debug(ctx context.Context, f string, v ...interface{})

	// Info is for logging information that is useful for users.
	Info(ctx context.Context, f string, v ...interface{})

	// Notice is for logging information that is useful for users
	// that is of a higher importance than Info.
	Notice(ctx context.Context, f string, v ...interface{})

	// Warning is for logging information that may imply that
	// something untoward has occurred, but that is not a hard error.
	Warning(ctx context.Context, f string, v ...interface{})

	// Error is for logging error messages. Use this in error checking.
	Error(ctx context.Context, f string, v ...interface{})

	// Critical should be used infrequently, and is for cases where
	// human intervention is required to stop catastrophic failure.
	// e.g: losing all units in a cluster, impending nuclear missile launch.
	Critical(ctx context.Context, f string, v ...interface{})
}

Logger provides an interface for other loggers to implement.

func NewLogger

func NewLogger(config Config) Logger

NewLogger returns a Logger.

Jump to

Keyboard shortcuts

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