Giter Site home page Giter Site logo

log's Introduction

log

import "github.com/tmc/log"

Package log wraps logrus to include source line/function information

inspired by prometheus/common/log

doc.go log.go

func Debug(args ...interface{})

Debug logs a message at level Debug on the standard logger.

func Debugln(args ...interface{})

Debugln logs a message at level Debug on the standard logger.

func Error(args ...interface{})

Error logs a message at level Error on the standard logger.

func Errorln(args ...interface{})

Errorln logs a message at level Error on the standard logger.

func Fatal(args ...interface{})

Fatal logs a message at level Fatal on the standard logger.

func Fatalln(args ...interface{})

Fatalln logs a message at level Fatal on the standard logger.

func Info(args ...interface{})

Info logs a message at level Info on the standard logger.

func Infoln(args ...interface{})

Infoln logs a message at level Info on the standard logger.

func SetLevel(level Level)

SetLevel sets the Level of the base logger

func Warn(args ...interface{})

Warn logs a message at level Warn on the standard logger.

func Warnln(args ...interface{})

Warnln logs a message at level Warn on the standard logger.

type Level uint8

Level describes the log severity level.

const (
    // PanicLevel level, highest level of severity. Logs and then calls panic with the
    // message passed to Debug, Info, ...
    PanicLevel Level = iota
    // FatalLevel level. Logs and then calls `os.Exit(1)`. It will exit even if the
    // logging level is set to Panic.
    FatalLevel
    // ErrorLevel level. Logs. Used for errors that should definitely be noted.
    // Commonly used for hooks to send errors to an error tracking service.
    ErrorLevel
    // WarnLevel level. Non-critical entries that deserve eyes.
    WarnLevel
    // InfoLevel level. General operational entries about what's going on inside the
    // application.
    InfoLevel
    // DebugLevel level. Usually only enabled when debugging. Very verbose logging.
    DebugLevel
)
type Logger interface {
    SetLevel(level Level)
    SetOut(out io.Writer)

    Debug(...interface{})
    Debugln(...interface{})

    Info(...interface{})
    Infoln(...interface{})

    Warn(...interface{})
    Warnln(...interface{})

    Error(...interface{})
    Errorln(...interface{})

    Fatal(...interface{})
    Fatalln(...interface{})

    With(key string, value interface{}) Logger
    WithError(err error) Logger
}

Logger is an interface that describes logging.

func Base() Logger

Base returns the base logger.

func New() Logger

New returns a new logger.

func With(key string, value interface{}) Logger

With attaches a key,value pair to a logger.

func WithError(err error) Logger

WithError returns a Logger that will print an error along with the next message.

log's People

Contributors

tmc avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.