Documentation
¶
Index ¶
- func Close()
- func Error(a ...interface{})
- func Errorf(format string, a ...interface{})
- func Fatal(a ...interface{})
- func Fatalf(format string, a ...interface{})
- func Info(a ...interface{})
- func Infof(format string, a ...interface{})
- func Print(a ...interface{})
- func Printf(format string, a ...interface{})
- func Rotate()
- func SetDefault(v Logger)
- func SetLevel(v int)
- func SetOutput(level int, prefix string, info, error io.Writer)
- func SetPath(s string)
- type Entry
- type Formatter
- type InfoLogger
- type JSONFormatter
- type Log
- func (p Log) Error(args ...interface{})
- func (p Log) Errorf(format string, a ...interface{})
- func (p Log) NewWithPrefix(prefix string) Logger
- func (p Log) Output(w io.Writer, a ...interface{})
- func (p Log) Outputf(w io.Writer, format string, a ...interface{})
- func (p Log) Print(a ...interface{})
- func (p Log) Printf(format string, a ...interface{})
- func (p Log) V(level int) InfoLogger
- func (p *Log) WithFormatter(v Formatter) Logger
- type Logger
- type TextFormatter
- type Write
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fatal ¶
func Fatal(a ...interface{})
Fatal is equivalent to l.Print() followed by a call to os.Exit(1).
func Fatalf ¶
func Fatalf(format string, a ...interface{})
Fatalf is equivalent to l.Printf() followed by a call to os.Exit(1).
func SetDefault ¶
func SetDefault(v Logger)
Types ¶
type Entry ¶
type Entry struct {
// Time at which the log entry was created
Time string `json:"time"`
// Message passed to Info, Error
Message interface{} `json:"msg"`
}
type InfoLogger ¶
type InfoLogger interface {
// Info logs a non-error message. This is behaviorally akin to fmt.Print.
Print(a ...interface{})
// Infof logs a formatted non-error message.
Printf(format string, a ...interface{})
}
func V ¶
func V(level int) InfoLogger
type JSONFormatter ¶
type JSONFormatter struct{}
type Log ¶
type Log struct {
Prefix string
Level int
Formatter Formatter
// contains filtered or unexported fields
}
func (Log) NewWithPrefix ¶
func (Log) Printf ¶
Printf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.
func (Log) V ¶
func (p Log) V(level int) InfoLogger
func (*Log) WithFormatter ¶
type Logger ¶
type Logger interface {
// All Loggers implement InfoLogger. Calling InfoLogger methods directly on
// a Logger value is equivalent to calling them on a V(0) InfoLogger. For
// example, logger.Info() produces the same result as logger.V(0).Info.
InfoLogger
// Error logs a error message. This is behaviorally akin to fmt.Print.
Error(args ...interface{})
// Errorf logs a formatted error message.
Errorf(format string, args ...interface{})
// V returns an InfoLogger value for a specific verbosity level. A higher
// verbosity level means a log message is less important.
V(level int) InfoLogger
// NewWithPrefix returns a Logger which prefixes all messages.
NewWithPrefix(prefix string) Logger
WithFormatter(v Formatter) Logger
}
Logger represents the ability to log messages, both errors and not.
func NewWithPrefix ¶
type TextFormatter ¶
type TextFormatter struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.