logging

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2019 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package logging provides logging facilities.

Index

Constants

This section is empty.

Variables

View Source
var RootLogger = &Logger{}

RootLogger is the root logger from which all other loggers derive.

Functions

This section is empty.

Types

type Logger

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

Logger is the main logger type. It has the novel property that it still functions if nil, but it doesn't log anything. It is designed to use the standard logger provided by the log package, so it respects any flags set for that logger. It is safe for concurrent usage.

func (*Logger) Debug

func (l *Logger) Debug(v ...interface{})

Debug logs information with semantics equivalent to fmt.Print, but only if debugging is enabled (otherwise it's a no-op).

func (*Logger) DebugWriter

func (l *Logger) DebugWriter() io.Writer

DebugWriter returns an io.Writer that writes lines using Debugln.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

Debugf logs information with semantics equivalent to fmt.Printf, but only if debugging is enabled (otherwise it's a no-op).

func (*Logger) Debugln

func (l *Logger) Debugln(v ...interface{})

Debugln logs information with semantics equivalent to fmt.Println, but only if debugging is enabled (otherwise it's a no-op).

func (*Logger) Error

func (l *Logger) Error(err error)

Error logs error information with an error prefix and red color.

func (*Logger) Print

func (l *Logger) Print(v ...interface{})

Print logs information with semantics equivalent to fmt.Print.

func (*Logger) Printf

func (l *Logger) Printf(format string, v ...interface{})

Printf logs information with semantics equivalent to fmt.Printf.

func (*Logger) Println

func (l *Logger) Println(v ...interface{})

Println logs information with semantics equivalent to fmt.Println.

func (*Logger) Sublogger

func (l *Logger) Sublogger(name string) *Logger

Sublogger creates a new sublogger with the specified name.

func (*Logger) Warn

func (l *Logger) Warn(err error)

Warn logs error information with a warning prefix and yellow color.

func (*Logger) Writer

func (l *Logger) Writer() io.Writer

Writer returns an io.Writer that writes lines using Println.

Jump to

Keyboard shortcuts

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