Documentation ¶
Overview ¶
Package log implements low-level logging.
Users should not use this package directly. Instead, the gondola/app.Context.Logger method should be used to obtain an Interface to log messages.
Index ¶
- Constants
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func Debugln(v ...interface{})
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Errorln(v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Flags() int
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func Infoln(v ...interface{})
- func Log(level LLevel, v ...interface{})
- func Logf(level LLevel, format string, v ...interface{})
- func Logln(level LLevel, v ...interface{})
- func Nil(v interface{})
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Panicln(v ...interface{})
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Println(v ...interface{})
- func SetFlags(flag int)
- func SetLevel(level LLevel)
- func SetOutput(out Writer)
- func Warning(v ...interface{})
- func Warningf(format string, v ...interface{})
- func Warningln(v ...interface{})
- type IOWriter
- type Interface
- type LLevel
- type Logger
- func (l *Logger) AddWriter(w Writer)
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Debugln(v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Errorln(v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) Fatalln(v ...interface{})
- func (l *Logger) Flags() int
- func (l *Logger) FormatMessage(level LLevel, calldepth int, s string) []byte
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Infoln(v ...interface{})
- func (l *Logger) IsDebug() bool
- func (l *Logger) Level() LLevel
- func (l *Logger) Log(level LLevel, v ...interface{})
- func (l *Logger) Logf(level LLevel, format string, v ...interface{})
- func (l *Logger) Logln(level LLevel, v ...interface{})
- func (l *Logger) Nil(v interface{})
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) Panicf(format string, v ...interface{})
- func (l *Logger) Panicln(v ...interface{})
- func (l *Logger) Print(v ...interface{})
- func (l *Logger) Printf(format string, v ...interface{})
- func (l *Logger) Println(v ...interface{})
- func (l *Logger) RemoveWriters()
- func (l *Logger) SetFlags(flags int)
- func (l *Logger) SetLevel(level LLevel)
- func (l *Logger) Warning(v ...interface{})
- func (l *Logger) Warningf(format string, v ...interface{})
- func (l *Logger) Warningln(v ...interface{})
- func (l *Logger) Write(level LLevel, calldepth int, v ...interface{})
- func (l *Logger) Writef(level LLevel, calldepth int, format string, v ...interface{})
- func (l *Logger) Writeln(level LLevel, calldepth int, v ...interface{})
- type SmtpWriter
- type Writer
Constants ¶
const ( // Bits or'ed together to control what's printed. There is no control over the // order they appear (the order listed here) or the format they present (as // described in the comments). A colon appears after these items: // 2009/0123 01:23:23.123123 /a/b/c/d.go:23: message Ldate = 1 << iota // the date: 2009/01/23 Ltime // the time: 01:23:23 Lmicroseconds // microsecond resolution: 01:23:23.123123. assumes Ltime. Llongfile // full file name and line number: /a/b/c/d.go:23 Lshortfile // final file name element and line number: d.go:23. overrides Llongfile Llevel // preprend the message level Lshortlevel // preprend the abbreviated message level (overrides Llevel) Lcolored // uses colors around the level name LstdFlags = Ldate | Ltime | Lshortlevel | Lcolored // initial values for the standard logger )
These flags define which text to prefix to each log entry generated by the Logger.
Variables ¶
var (
Std = New(NewIOWriter(os.Stderr, LDebug), LstdFlags, LDefault)
)
Functions ¶
func Fatal ¶
func Fatal(v ...interface{})
Fatal is equivalent to Print() followed by a call to os.Exit(1).
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf is equivalent to Printf() followed by a call to os.Exit(1).
func Fatalln ¶
func Fatalln(v ...interface{})
Fatalln is equivalent to Println() followed by a call to os.Exit(1).
func Nil ¶
func Nil(v interface{})
Nil does nothing if the argument is nil. Otherwise, it's equivalent to Panic().
func Panic ¶
func Panic(v ...interface{})
Panic is equivalent to Print() followed by a call to panic().
func Panicf ¶
func Panicf(format string, v ...interface{})
Panicf is equivalent to Printf() followed by a call to panic().
func Panicln ¶
func Panicln(v ...interface{})
Panicln is equivalent to Println() followed by a call to panic().
func Print ¶
func Print(v ...interface{})
Print calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Print.
func Printf ¶
func Printf(format string, v ...interface{})
Printf calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Printf.
func Println ¶
func Println(v ...interface{})
Println calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Println.
Types ¶
type Interface ¶
type Interface interface { // Debug formats its arguments like fmt.Print and records a // log message at the debug level. Debug(args ...interface{}) // Debugf formats its arguments like fmt.Printf and records a // log message at the debug level. Debugf(format string, args ...interface{}) // Info formats its arguments like fmt.Print and records a // log message at the info level. Info(args ...interface{}) // Infof formats its arguments like fmt.Printf and records a // log message at the info level. Infof(format string, args ...interface{}) // Warning formats its arguments like fmt.Print and records a // log message at the warning level. Warning(args ...interface{}) // Warningf formats its arguments like fmt.Printf and records a // log message at the warning level. Warningf(format string, args ...interface{}) // Error formats its arguments like fmt.Print and records a // log message at the error level. Error(args ...interface{}) // Errorf formats its arguments like fmt.Printf and records a // log message at the error level. Errorf(format string, args ...interface{}) }
Interface is the interface implemented by any logger in Gondola.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
A Logger represents an active logging object that generates lines of output to an io.Writer. Each logging operation makes a single call to the Writer's Write method. A Logger can be used simultaneously from multiple goroutines; it guarantees to serialize access to the Writer.
func New ¶
New creates a new Logger. The out variable sets the destination to which log data will be written. The flag argument defines the logging properties.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(v ...interface{})
Fatal is equivalent to l.Print() followed by a call to os.Exit(1).
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(v ...interface{})
Fatalln is equivalent to l.Println() followed by a call to os.Exit(1).
func (*Logger) FormatMessage ¶
func (*Logger) Nil ¶
func (l *Logger) Nil(v interface{})
Nil does nothing if the argument is nil. Otherwise, it's equivalent to Panic().
func (*Logger) Panic ¶
func (l *Logger) Panic(v ...interface{})
Panic is equivalent to l.Print() followed by a call to panic().
func (*Logger) Panicln ¶
func (l *Logger) Panicln(v ...interface{})
Panicln is equivalent to l.Println() followed by a call to panic().
func (*Logger) RemoveWriters ¶
func (l *Logger) RemoveWriters()
func (*Logger) Write ¶
Write is a generic low-level interface to a Logger. By using the calldepth parameters, wrappers can define their own functions which correctly obtain the PC for the callers (otherwise, all the calls to the logging would appear as coming from the wrapper.
type SmtpWriter ¶
type SmtpWriter struct {
// contains filtered or unexported fields
}
func NewSmtpWriter ¶
func NewSmtpWriter(level LLevel, server, from, to string) *SmtpWriter
func (*SmtpWriter) Level ¶
func (w *SmtpWriter) Level() LLevel