Documentation ¶
Index ¶
- Constants
- func Critical(format string, args ...interface{})
- func Debug(format string, args ...interface{})
- func Error(format string, args ...interface{})
- func Info(format string, args ...interface{})
- func SetupGlobal(logger Logger)
- func Warning(format string, args ...interface{})
- type LogLevel
- type Logger
- func (l Logger) Critical(format string, args ...interface{})
- func (l Logger) Debug(format string, args ...interface{})
- func (l Logger) Error(format string, args ...interface{})
- func (l Logger) Info(format string, args ...interface{})
- func (l Logger) Log(level LogLevel, format string, args ...interface{})
- func (l Logger) Output(depth int, level LogLevel, msg string)
- func (l Logger) Warning(format string, args ...interface{})
- type RotatedFile
- type SMTPWriter
Constants ¶
const ( 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 // the level name: DBUG|INFO|WARN... Lcolor // colorful message LstdFlags = Ldate | Ltime // initial values for the standard logger LdefaultFlags = LstdFlags | Llevel | Lcolor LfullFlags = LdefaultFlags | Lshortfile )
These flags define which text to prefix to each log entry generated by the Logger.
Variables ¶
This section is empty.
Functions ¶
func Critical ¶
func Critical(format string, args ...interface{})
Critical logs Critical level message
func SetupGlobal ¶
func SetupGlobal(logger Logger)
Types ¶
type LogLevel ¶
type LogLevel int
LogLevel defines level of log message.
Available LogLevel const, the higher the more importent.
type Logger ¶
Logger function type
func Group ¶
Group combines multiple Logger interface into a new Logger which outputs all log message into each Logger of provided.
func (Logger) Output ¶
Output writes the output for a logging event. The string s contains the text to print specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. depth is used to recover the PC and is provided for generality, although at the moment on all pre-defined paths it will be 2.
type RotatedFile ¶
type RotatedFile struct {
// contains filtered or unexported fields
}
RotatedFile is a os.File wrapper to log message. All of its methods are goroutine-safe.
func OpenFile ¶
func OpenFile(name string, mode os.FileMode) (*RotatedFile, error)
OpenFile creates a new RotatedFile instance, and open the file.
func (*RotatedFile) Close ¶
func (rf *RotatedFile) Close() error
Close close the inner *os.File if it's not nil.
func (*RotatedFile) Listen ¶
func (rf *RotatedFile) Listen(sig ...os.Signal)
Listen listens the provided signals, if any of these singals was received, reopen the file. This method is used for logrotate and it will block the current goroutine. If you don't call this method, it works as the same as normal *os.File.
type SMTPWriter ¶
type SMTPWriter struct {
// contains filtered or unexported fields
}
SMTPWriter struct
func NewSMTPWriter ¶
func NewSMTPWriter(addr, username, password, subject string, to ...string) (*SMTPWriter, error)
NewSMTPWriter create a new SMTPWriter instance.