tsuru: github.com/tsuru/tsuru/log Index | Files

package log

import "github.com/tsuru/tsuru/log"

Package log provides logging utility.

It abstracts the logger from the standard log package, allowing the developer to pick the logging target, changing this to a file, or syslog, for example.

Index

Package Files

file_logger.go log.go multi_logger.go syslog_logger.go

Variables

var DefaultTarget = new(Target)

func Debug Uses

func Debug(v string)

Debug is a wrapper for DefaultTarget.Debug.

func Debugf Uses

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

Debugf is a wrapper for DefaultTarget.Debugf.

func Error Uses

func Error(v error)

Error is a wrapper for DefaultTarget.Error.

func Errorf Uses

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

Errorf is a wrapper for DefaultTarget.Errorf.

func Fatal Uses

func Fatal(v string)

Fatal is a wrapper for DefaultTarget.Fatal.

func Fatalf Uses

func Fatalf(format string, v ...interface{})

Fatalf is a wrapper for DefaultTarget.Errorf.

func GetStdLogger Uses

func GetStdLogger() *log.Logger

GetStdLogger is a wrapper for DefaultTarget.GetStdLogger.

func Init Uses

func Init() error

func SetLogger Uses

func SetLogger(logger Logger)

SetLogger is a wrapper for DefaultTarget.SetLogger.

func WrapError Uses

func WrapError(err error) error

func Write Uses

func Write(w io.Writer, content []byte) error

type Logger Uses

type Logger interface {
    Error(string)
    Errorf(string, ...interface{})
    Fatal(string)
    Fatalf(string, ...interface{})
    Debug(string)
    Debugf(string, ...interface{})
    GetStdLogger() *log.Logger
}

func NewFileLogger Uses

func NewFileLogger(fileName string, debug bool) Logger

func NewMultiLogger Uses

func NewMultiLogger(loggers ...Logger) Logger

func NewSyslogLogger Uses

func NewSyslogLogger(tag string, debug bool) (Logger, error)

func NewWriterLogger Uses

func NewWriterLogger(writer io.Writer, debug bool) Logger

type Target Uses

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

Target is the current target for the log package.

func (*Target) Debug Uses

func (t *Target) Debug(v string)

Debug writes the value to the Target logger.

func (*Target) Debugf Uses

func (t *Target) Debugf(format string, v ...interface{})

Debugf writes the formatted string to the Target logger.

func (*Target) Error Uses

func (t *Target) Error(v error)

Error writes the given values to the Target logger.

func (*Target) Errorf Uses

func (t *Target) Errorf(format string, v ...interface{})

Errorf writes the formatted string to the Target logger.

func (*Target) Fatal Uses

func (t *Target) Fatal(v string)

Fatal writes the given values to the Target logger.

func (*Target) Fatalf Uses

func (t *Target) Fatalf(format string, v ...interface{})

Fatalf writes the formatted string to the Target logger.

func (*Target) GetStdLogger Uses

func (t *Target) GetStdLogger() *log.Logger

GetStdLogger returns a standard Logger instance useful for configuring log in external packages.

func (*Target) SetLogger Uses

func (t *Target) SetLogger(l Logger)

SetLogger defines a new logger for the current target.

See the builtin log package for more details.

Package log imports 8 packages (graph) and is imported by 205 packages. Updated 2019-01-11. Refresh now. Tools for package owners.