gonelog: github.com/One-com/gonelog Index | Files | Directories

package gonelog

import "github.com/One-com/gonelog"

The main package of gonelog is gonelog/log. This top-level package only contains interfaces used to organize methods.

Index

Package Files

interfaces.go

type LevelLogger Uses

type LevelLogger interface {

    // Returns true if the Logger will generate events at this log level.
    Does(level syslog.Priority) bool

    // Shorthand functions to Log() generating events on syslog levels.
    ALERT(msg string, kv ...interface{})
    CRIT(msg string, kv ...interface{})
    ERROR(msg string, kv ...interface{})
    WARN(msg string, kv ...interface{})
    NOTICE(msg string, kv ...interface{})
    INFO(msg string, kv ...interface{})
    DEBUG(msg string, kv ...interface{})

    // Returns a function which will log at the given level if called and a boolean
    // indicating whether the log level is enabled.
    // To be used like:
    // if f,ok := log.ERRORok(); ok {f("message")}
    ALERTok() (LogFunc, bool)
    CRITok() (LogFunc, bool)
    ERRORok() (LogFunc, bool)
    WARNok() (LogFunc, bool)
    NOTICEok() (LogFunc, bool)
    INFOok() (LogFunc, bool)
    DEBUGok() (LogFunc, bool)
}

LevelLogger is the extended leveled log API

type LevelLoggerFull Uses

type LevelLoggerFull interface {
    LevelLogger

    Level() syslog.Priority

    SetLevel(level syslog.Priority) bool
    IncLevel() bool
    DecLevel() bool

    With(kv ...interface{}) *Logger
}

LevelLoggerFull includes more methods than those needed for actual logging

type LogFunc Uses

type LogFunc func(msg string, kv ...interface{})

LogFunc is the type of the function returned by *ok() methods, which will log at the level queried about if called.

type Logger Uses

type Logger interface {

    // Will generate a log event with this level if the Logger log level is
    // high enough.
    // The event will have the given log message and key/value structured data.
    Log(level syslog.Priority, message string, kv ...interface{}) error

    // further interfaces
    StdLogger
    LevelLogger
}

Logger is the the main interface of gonelog A "Logger" makes available methods compatible with the stdlib logger and an extended API for leveled logging. Logger is implemented by *log.Logger

type StdFormatter Uses

type StdFormatter interface {
    Flags() int
    Prefix() string
}

StdFormatter allows quering a formatting handler for flags and prefix compatible with the stdlib log library

type StdLogger Uses

type StdLogger interface {
    Fatal(v ...interface{})
    Fatalf(format string, v ...interface{})
    Fatalln(v ...interface{})

    Panic(v ...interface{})
    Panicf(format string, v ...interface{})
    Panicln(v ...interface{})

    Print(v ...interface{})
    Printf(format string, v ...interface{})
    Println(v ...interface{})
}

StdLogger is the interface used by the standard lib *log.Logger This is the API for actually logging stuff.

type StdLoggerFull Uses

type StdLoggerFull interface {
    StdLogger
    StdMutableFormatter
    Output(calldepth int, s string) error
}

StdLoggerFull is mostly for documentation purposes. This is the full set of methods supported by the standard logger. You would only use the extra methods when you know exactly which kind of logger you are dealing with anyway.

type StdMutableFormatter Uses

type StdMutableFormatter interface {
    StdFormatter
    SetFlags(flag int)
    SetPrefix(prefix string)
    SetOutput(w io.Writer)
}

StdMutableFormatter is the interface for a Logger which directly can change the stdlib flags, prefix and output io.Writer attributes in a synchronized manner. Since gonelog Handlers are immutable, it's not used for Formatters.

Directories

PathSynopsis
context
logPackage gonelog/log is a drop-in replacement for the standard Go logging library "log" which is fully source code compatible support all the standard library API while at the same time offering advanced logging features through an extended API.
metric
syslogGonelog uses the syslog level contants source code compatible with the standard library.
term

Package gonelog imports 2 packages (graph) and is imported by 2 packages. Updated 2016-11-06. Refresh now. Tools for package owners.