Documentation ¶
Index ¶
- Constants
- Variables
- type Appender
- type Log
- func (l *Log) Critical(v ...interface{})
- func (l *Log) Criticalf(format string, v ...interface{})
- func (*Log) Debug(v ...interface{})
- func (*Log) Debugf(format string, v ...interface{})
- func (l *Log) Error(v ...interface{})
- func (l *Log) Errorf(format string, v ...interface{})
- func (l *Log) GetLog(prefix string, tags ...string) (res *Log)
- func (l *Log) Info(v ...interface{})
- func (l *Log) Infof(format string, v ...interface{})
- func (l *Log) Notice(v ...interface{})
- func (l *Log) Noticef(format string, v ...interface{})
- func (l *Log) Prefix() (res string)
- func (l *Log) Print(v ...interface{})
- func (l *Log) Printf(format string, v ...interface{})
- func (l *Log) Tags() (res []string)
- func (*Log) Trace(v ...interface{})
- func (*Log) Tracef(format string, v ...interface{})
- func (l *Log) Warning(v ...interface{})
- func (l *Log) Warningf(format string, v ...interface{})
- func (l *Log) WithTags(tags ...string) (res *Log)
- type TextAppender
Constants ¶
const ( // Ldate adds the date in the local time zone: 2009/01/23 Ldate = 1 << iota // Ltime adds the time in the local time zone: 01:23:23 Ltime // Lmicroseconds adds microsecond resolution: 01:23:23.123123. Assumes LTime. Lmicroseconds // Llongfile adds full file name and line number: /a/b/c/d.go:23 Llongfile // Lshortfile adds final file name element and line number: d.go:23. // overrides Llongfile Lshortfile // LUTC if Ldate or Ltime is set, use UTC rather than the local time zone LUTC // Lcompact removes whitespace from log lines Lcompact // LstdFlags initial values for the standard logger LstdFlags = Lshortfile | Lcompact )
Variables ¶
var DefaultAppender = NewTextAppender(os.Stderr, LstdFlags)
Default TextAppender
Functions ¶
This section is empty.
Types ¶
type Appender ¶
type Appender interface { // Append sends log line to appender. Append should be thread-safe. Append(level, line string) // Clone returns new appender with given prefix and tags. Clone(prefix string, tags []string) Appender }
Appender accepts log entries
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func (*Log) Critical ¶
func (l *Log) Critical(v ...interface{})
Critical logs value with CRITICAL severity level.
func (*Log) Debug ¶
func (*Log) Debug(v ...interface{})
Debug logs value with DEBUG severity level only if "debug" tag is provided on build.
func (*Log) Debugf ¶
Debugf logs formatted value with DEBUG severity level only if "debug" tag is provided on build.
func (*Log) Error ¶
func (l *Log) Error(v ...interface{})
Error logs value with ERROR severity level.
func (*Log) Notice ¶
func (l *Log) Notice(v ...interface{})
Notice logs value with NOTICE severity level.
func (*Log) Print ¶
func (l *Log) Print(v ...interface{})
Print is synonym to Info used for compatibility with "log" package.
func (*Log) Trace ¶
func (*Log) Trace(v ...interface{})
Trace logs value with TRACE severity level only if "trace" tag is provided on build.
func (*Log) Tracef ¶
Tracef logs formatted value with TRACE severity level only if "trace" tag is provided on build.
func (*Log) Warning ¶
func (l *Log) Warning(v ...interface{})
Warning logs value with WARNING severity level.
type TextAppender ¶
type TextAppender struct {
// contains filtered or unexported fields
}
TextAppender is default for logx
Format:
time LEVEL prefix [tags] file:line message
func NewTextAppender ¶
func NewTextAppender(output io.Writer, flags int) (a *TextAppender)
NewTextAppender returns new appender without prefix and tags
func (*TextAppender) Append ¶
func (a *TextAppender) Append(level, line string)