leaps: github.com/Jeffail/leaps/lib/util/service/log Index | Files

package log

import "github.com/Jeffail/leaps/lib/util/service/log"

Package log - Some utilities for logging and stats aggregation/pushing. This package wraps third party libraries in agnostic API calls so they can be swapped.

Index

Package Files

interface.go logger.go package.go

Constants

const (
    LogOff   int = 0
    LogFatal int = 1
    LogError int = 2
    LogWarn  int = 3
    LogInfo  int = 4
    LogDebug int = 5
    LogTrace int = 6
    LogAll   int = 7
)

Logger level constants

Variables

var (
    ErrClientNil = errors.New("the client pointer was nil")
)

Errors used throughout the package.

type Logger Uses

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

Logger - A logger object with support for levelled logging and modular components.

func (*Logger) Debugf Uses

func (l *Logger) Debugf(message string, other ...interface{})

Debugf - Print a debug message to the console.

func (*Logger) Debugln Uses

func (l *Logger) Debugln(message string)

Debugln - Print a debug message to the console.

func (*Logger) Errorf Uses

func (l *Logger) Errorf(message string, other ...interface{})

Errorf - Print an error message to the console.

func (*Logger) Errorln Uses

func (l *Logger) Errorln(message string)

Errorln - Print an error message to the console.

func (*Logger) Fatalf Uses

func (l *Logger) Fatalf(message string, other ...interface{})

Fatalf - Print a fatal message to the console. Does NOT cause panic.

func (*Logger) Fatalln Uses

func (l *Logger) Fatalln(message string)

Fatalln - Print a fatal message to the console. Does NOT cause panic.

func (*Logger) Infof Uses

func (l *Logger) Infof(message string, other ...interface{})

Infof - Print an information message to the console.

func (*Logger) Infoln Uses

func (l *Logger) Infoln(message string)

Infoln - Print an information message to the console.

func (*Logger) NewModule Uses

func (l *Logger) NewModule(prefix string) Modular

NewModule - Creates a new logger object from the previous, using the same configuration, but adds an extra prefix to represent a submodule.

func (*Logger) Output Uses

func (l *Logger) Output(calldepth int, s string) error

Output - Prints s to our output. Calldepth is ignored.

func (*Logger) Tracef Uses

func (l *Logger) Tracef(message string, other ...interface{})

Tracef - Print a trace message to the console.

func (*Logger) Traceln Uses

func (l *Logger) Traceln(message string)

Traceln - Print a trace message to the console.

func (*Logger) Warnf Uses

func (l *Logger) Warnf(message string, other ...interface{})

Warnf - Print a warning message to the console.

func (*Logger) Warnln Uses

func (l *Logger) Warnln(message string)

Warnln - Print a warning message to the console.

type LoggerConfig Uses

type LoggerConfig struct {
    Prefix       string `json:"prefix" yaml:"prefix"`
    LogLevel     string `json:"log_level" yaml:"log_level"`
    AddTimeStamp bool   `json:"add_timestamp" yaml:"add_timestamp"`
    JSONFormat   bool   `json:"json_format" yaml:"json_format"`
}

LoggerConfig - Holds configuration options for a logger object.

func NewLoggerConfig Uses

func NewLoggerConfig() LoggerConfig

NewLoggerConfig - Returns a logger configuration with the default values for each field.

type Modular Uses

type Modular interface {
    NewModule(prefix string) Modular

    Fatalf(message string, other ...interface{})
    Errorf(message string, other ...interface{})
    Warnf(message string, other ...interface{})
    Infof(message string, other ...interface{})
    Debugf(message string, other ...interface{})
    Tracef(message string, other ...interface{})

    Fatalln(message string)
    Errorln(message string)
    Warnln(message string)
    Infoln(message string)
    Debugln(message string)
    Traceln(message string)

    Output(calldepth int, s string) error
}

Modular - A log printer that allows you to branch new modules.

func NewLogger Uses

func NewLogger(stream io.Writer, config LoggerConfig) Modular

NewLogger - Create and return a new logger object.

Package log imports 6 packages (graph) and is imported by 4 packages. Updated 2018-02-20. Refresh now. Tools for package owners.