log

package
v0.0.0-...-2d2b8e1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package log provides the logging facilities used for horizon.

You may notice that this package does not expose the "Fatal" family of logging functions: this is intentional. This package is specifically geared to logging within the context of an http server, and our chosen path for responding to "Oh my god something is horribly wrong" within the context of an HTTP request is to panic on that request.

Index

Constants

View Source
const (
	PanicLevel = logrus.PanicLevel
	ErrorLevel = logrus.ErrorLevel
	WarnLevel  = logrus.WarnLevel
	InfoLevel  = logrus.InfoLevel
	DebugLevel = logrus.DebugLevel
)

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug logs a message at the debug severity.

func Debugf

func Debugf(format string, args ...interface{})

Debugf logs a message at the debug severity.

func Error

func Error(args ...interface{})

Error logs a message at the Error severity.

func Errorf

func Errorf(format string, args ...interface{})

Errorf logs a message at the Error severity.

func Info

func Info(args ...interface{})

Info logs a message at the Info severity.

func Infof

func Infof(format string, args ...interface{})

Infof logs a message at the Info severity.

func New

func New() (result *Entry, m *Metrics)

New creates a new logger according to horizon specifications.

func Panic

func Panic(args ...interface{})

Panic logs a message at the Panic severity.

func Panicf

func Panicf(format string, args ...interface{})

Panicf logs a message at the Panic severity.

func PushContext

func PushContext(parent context.Context, modFn func(*Entry) *Entry) context.Context

PushContext is a helper method to derive a new context with a modified logger bound to it, where the logger is derived from the current value on the context.

func Set

func Set(parent context.Context, logger *Entry) context.Context

Set establishes a new context to which the provided sub-logger is bound

func Warn

func Warn(args ...interface{})

Warn logs a message at the Warn severity.

func Warnf

func Warnf(format string, args ...interface{})

Warnf logs a message at the Warn severity.

Types

type Entry

type Entry struct {
	logrus.Entry
}
var DefaultLogger *Entry

func Ctx

func Ctx(ctx context.Context) *Entry

C returns the logger bound to the provided context, otherwise providing the default logger.

func FromContext

func FromContext(ctx context.Context) *Entry

DEPRECATED: Use Ctx instead.

func WithField

func WithField(key string, value interface{}) *Entry

func WithFields

func WithFields(fields F) *Entry

func WithStack

func WithStack(stackProvider interface{}) *Entry

func (*Entry) Debug

func (e *Entry) Debug(args ...interface{})

Debug logs a message at the debug severity.

func (*Entry) Debugf

func (e *Entry) Debugf(format string, args ...interface{})

Debugf logs a message at the debug severity.

func (*Entry) Error

func (e *Entry) Error(args ...interface{})

Error logs a message at the Error severity.

func (*Entry) Errorf

func (e *Entry) Errorf(format string, args ...interface{})

Errorf logs a message at the Error severity.

func (*Entry) Info

func (e *Entry) Info(args ...interface{})

Info logs a message at the Info severity.

func (*Entry) Infof

func (e *Entry) Infof(format string, args ...interface{})

Infof logs a message at the Info severity.

func (*Entry) Panic

func (e *Entry) Panic(args ...interface{})

Panic logs a message at the Panic severity.

func (*Entry) Panicf

func (e *Entry) Panicf(format string, args ...interface{})

Panicf logs a message at the Panic severity.

func (*Entry) Warn

func (e *Entry) Warn(args ...interface{})

Warn logs a message at the Warn severity.

func (*Entry) Warnf

func (e *Entry) Warnf(format string, args ...interface{})

Warnf logs a message at the Warn severity.

func (*Entry) WithField

func (e *Entry) WithField(key string, value interface{}) *Entry

func (*Entry) WithFields

func (e *Entry) WithFields(fields F) *Entry

func (*Entry) WithStack

func (e *Entry) WithStack(err error) *Entry

type F

type F logrus.Fields

type LogglyHook

type LogglyHook struct {
	FilteredKeys map[string]bool
	// contains filtered or unexported fields
}

LogglyHook sends logs to loggly

func NewLogglyHook

func NewLogglyHook(token string) *LogglyHook

NewLogglyHook creates a new hook

func (*LogglyHook) Fire

func (hook *LogglyHook) Fire(entry *logrus.Entry) error

func (*LogglyHook) Flush

func (hook *LogglyHook) Flush()

func (*LogglyHook) Levels

func (hook *LogglyHook) Levels() []logrus.Level

type Metrics

type Metrics map[logrus.Level]metrics.Meter

Metrics is a logrus hook-compliant struct that records metrics about logging when added to a logrus.Logger

var DefaultMetrics *Metrics

func NewMetrics

func NewMetrics() *Metrics

NewMetrics creates a new hook for recording metrics.

func (*Metrics) Fire

func (m *Metrics) Fire(e *logrus.Entry) error

Fire is triggered by logrus, in response to a logging event

func (*Metrics) Levels

func (m *Metrics) Levels() []logrus.Level

Levels returns the logging levels that will trigger this hook to run. In this case, all of them.

Jump to

Keyboard shortcuts

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