Documentation ¶
Index ¶
- func GlogHeader(level LogLevel, depth int) []byte
- func SetFormatter(f Formatter)
- func SetGlobalLogLevel(l LogLevel)
- type Formatter
- type GlogFormatter
- type LogLevel
- type PackageLogger
- func (p *PackageLogger) Debug(entries ...interface{})
- func (p *PackageLogger) Debugf(format string, args ...interface{})
- func (p *PackageLogger) Error(entries ...interface{})
- func (p *PackageLogger) Errorf(format string, args ...interface{})
- func (p *PackageLogger) Fatal(args ...interface{})
- func (p *PackageLogger) Fatalf(format string, args ...interface{})
- func (p *PackageLogger) Flush()
- func (p *PackageLogger) Info(entries ...interface{})
- func (p *PackageLogger) Infof(format string, args ...interface{})
- func (p *PackageLogger) LevelAt(l LogLevel) bool
- func (p *PackageLogger) Log(l LogLevel, args ...interface{})
- func (p *PackageLogger) Logf(l LogLevel, format string, args ...interface{})
- func (p *PackageLogger) Notice(entries ...interface{})
- func (p *PackageLogger) Noticef(format string, args ...interface{})
- func (p *PackageLogger) Panic(args ...interface{})
- func (p *PackageLogger) Panicf(format string, args ...interface{})
- func (p *PackageLogger) Print(args ...interface{})
- func (p *PackageLogger) Printf(format string, args ...interface{})
- func (p *PackageLogger) Println(args ...interface{})
- func (p *PackageLogger) Trace(entries ...interface{})
- func (p *PackageLogger) Tracef(format string, args ...interface{})
- func (p *PackageLogger) Warning(entries ...interface{})
- func (p *PackageLogger) Warningf(format string, args ...interface{})
- type RepoLogger
- type StringFormatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GlogHeader ¶
func SetFormatter ¶
func SetFormatter(f Formatter)
SetFormatter sets the formatting function for all logs.
func SetGlobalLogLevel ¶
func SetGlobalLogLevel(l LogLevel)
SetGlobalLogLevel sets the log level for all packages in all repositories registered with capnslog.
Types ¶
type Formatter ¶
type Formatter interface { Format(pkg string, level LogLevel, depth int, entries ...interface{}) Flush() }
func NewSyslogFormatter ¶
type GlogFormatter ¶
type GlogFormatter struct {
StringFormatter
}
func NewGlogFormatter ¶
func NewGlogFormatter(w io.Writer) *GlogFormatter
type LogLevel ¶
type LogLevel int8
LogLevel is the set of all log levels.
const ( // CRITICAL is the lowest log level; only errors which will end the program will be propagated. CRITICAL LogLevel = iota - 1 // ERROR is for errors that are not fatal but lead to troubling behavior. ERROR // WARNING is for errors which are not fatal and not errors, but are unusual. Often sourced from misconfigurations. WARNING // NOTICE is for normal but significant conditions. NOTICE // INFO is a log level for common, everyday log updates. INFO // DEBUG is the default hidden level for more verbose updates about internal processes. DEBUG // TRACE is for (potentially) call by call tracing of programs. TRACE )
func ParseLevel ¶
ParseLevel translates some potential loglevel strings into their corresponding levels.
type PackageLogger ¶
type PackageLogger struct {
// contains filtered or unexported fields
}
func NewPackageLogger ¶
func NewPackageLogger(repo string, pkg string) (p *PackageLogger)
NewPackageLogger creates a package logger object. This should be defined as a global var in your package, referencing your repo.
func (*PackageLogger) Debug ¶
func (p *PackageLogger) Debug(entries ...interface{})
func (*PackageLogger) Debugf ¶
func (p *PackageLogger) Debugf(format string, args ...interface{})
func (*PackageLogger) Error ¶
func (p *PackageLogger) Error(entries ...interface{})
func (*PackageLogger) Errorf ¶
func (p *PackageLogger) Errorf(format string, args ...interface{})
func (*PackageLogger) Fatal ¶
func (p *PackageLogger) Fatal(args ...interface{})
func (*PackageLogger) Fatalf ¶
func (p *PackageLogger) Fatalf(format string, args ...interface{})
func (*PackageLogger) Flush ¶
func (p *PackageLogger) Flush()
func (*PackageLogger) Info ¶
func (p *PackageLogger) Info(entries ...interface{})
func (*PackageLogger) Infof ¶
func (p *PackageLogger) Infof(format string, args ...interface{})
func (*PackageLogger) LevelAt ¶
func (p *PackageLogger) LevelAt(l LogLevel) bool
func (*PackageLogger) Log ¶
func (p *PackageLogger) Log(l LogLevel, args ...interface{})
Log a message at any level between ERROR and TRACE
func (*PackageLogger) Logf ¶
func (p *PackageLogger) Logf(l LogLevel, format string, args ...interface{})
Log a formatted string at any level between ERROR and TRACE
func (*PackageLogger) Notice ¶
func (p *PackageLogger) Notice(entries ...interface{})
func (*PackageLogger) Noticef ¶
func (p *PackageLogger) Noticef(format string, args ...interface{})
func (*PackageLogger) Panic ¶
func (p *PackageLogger) Panic(args ...interface{})
func (*PackageLogger) Panicf ¶
func (p *PackageLogger) Panicf(format string, args ...interface{})
func (*PackageLogger) Print ¶
func (p *PackageLogger) Print(args ...interface{})
func (*PackageLogger) Printf ¶
func (p *PackageLogger) Printf(format string, args ...interface{})
func (*PackageLogger) Println ¶
func (p *PackageLogger) Println(args ...interface{})
func (*PackageLogger) Trace ¶
func (p *PackageLogger) Trace(entries ...interface{})
func (*PackageLogger) Tracef ¶
func (p *PackageLogger) Tracef(format string, args ...interface{})
func (*PackageLogger) Warning ¶
func (p *PackageLogger) Warning(entries ...interface{})
func (*PackageLogger) Warningf ¶
func (p *PackageLogger) Warningf(format string, args ...interface{})
type RepoLogger ¶
type RepoLogger map[string]*PackageLogger
func GetRepoLogger ¶
func GetRepoLogger(repo string) (RepoLogger, error)
GetRepoLogger may return the handle to the repository's set of packages' loggers.
func MustRepoLogger ¶
func MustRepoLogger(repo string) RepoLogger
MustRepoLogger returns the handle to the repository's packages' loggers.
func (RepoLogger) ParseLogLevelConfig ¶
func (r RepoLogger) ParseLogLevelConfig(conf string) (map[string]LogLevel, error)
ParseLogLevelConfig parses a comma-separated string of "package=loglevel", in order, and returns a map of the results, for use in SetLogLevel.
func (RepoLogger) SetLogLevel ¶
func (r RepoLogger) SetLogLevel(m map[string]LogLevel)
SetLogLevel takes a map of package names within a repository to their desired loglevel, and sets the levels appropriately. Unknown packages are ignored. "*" is a special package name that corresponds to all packages, and will be processed first.
func (RepoLogger) SetRepoLogLevel ¶
func (r RepoLogger) SetRepoLogLevel(l LogLevel)
SetRepoLogLevel sets the log level for all packages in the repository.
type StringFormatter ¶
type StringFormatter struct {
// contains filtered or unexported fields
}
func NewStringFormatter ¶
func NewStringFormatter(w io.Writer) *StringFormatter
func (*StringFormatter) Flush ¶
func (s *StringFormatter) Flush()