Documentation ¶
Index ¶
- Variables
- type Level
- type Logger
- func (l *Logger) AddTags(tags ...string)
- func (l *Logger) Debug(v ...interface{})
- func (l *Logger) Debugf(format string, v ...interface{})
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) Errorf(format string, v ...interface{})
- func (l *Logger) Fatal(v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) Flag() int
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Level() Level
- func (l *Logger) New(tags ...string) *Logger
- func (l *Logger) Output(level Level, s string) error
- func (l *Logger) Panic(v ...interface{})
- func (l *Logger) Panicf(format string, v ...interface{})
- func (l *Logger) Print(v ...interface{})
- func (l *Logger) Printf(format string, v ...interface{})
- func (l *Logger) SetColor(colorful bool)
- func (l *Logger) SetFlag(flag int)
- func (l *Logger) SetLevel(level Level) error
- func (l *Logger) SetLevelByName(name string) error
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) SetSkip(depth int)
- func (l *Logger) SetTags(tags ...string)
- func (l *Logger) Skip() int
- func (l *Logger) Tags() []string
- func (l *Logger) Trace(v ...interface{})
- func (l *Logger) Warn(v ...interface{})
- func (l *Logger) Warnf(format string, v ...interface{})
- func (l *Logger) Write(b []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrLevel = errors.New("Invalid level")
)
Functions ¶
This section is empty.
Types ¶
type Level ¶
type Level int
const ( Ldebug Level Linfo Lwarn Lerror Lfatal Lpanic Ltrace Llog )
func ResolveLevelByName ¶
Resolves level by name, returns lmin without definition by default
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func New ¶
New creates a logger with the requested output. (default to stderr) NOTE: available outputs are [stdout|stderr|null|nil|path/to/file]
func (*Logger) Debug ¶
func (l *Logger) Debug(v ...interface{})
Debug calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.
func (*Logger) Debugf ¶
Debugf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Error ¶
func (l *Logger) Error(v ...interface{})
Error calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.
func (*Logger) Errorf ¶
Errorf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(v ...interface{})
Fatal calls l.Output to print to the logger and exit process with sign 1. Arguments are handled in the manner of fmt.Print.
func (*Logger) Fatalf ¶
Fatalf calls l.Output to print to the logger and exit process with sign 1. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Info ¶
func (l *Logger) Info(v ...interface{})
Info calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.
func (*Logger) Infof ¶
Infof calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Output ¶
Output writes the output for a logging event. The string s contains the text to print after the tags specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline.
func (*Logger) Panic ¶
func (l *Logger) Panic(v ...interface{})
Panic calls l.Output to print to the logger and panic process. Arguments are handled in the manner of fmt.Print.
func (*Logger) Panicf ¶
Panicf calls l.Output to print to the logger and panic process. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Print ¶
func (l *Logger) Print(v ...interface{})
Print calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.
func (*Logger) Printf ¶
Print calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.
func (*Logger) SetLevelByName ¶
SetLevelByName sets min level of output by name, available values are [debug|info|warn|error|fatal|panic|stack]. It returns ErrLevel for invalid name.
func (*Logger) Trace ¶
func (l *Logger) Trace(v ...interface{})
Trace calls l.Output to print to the logger and output process stacks, and exit process with sign 1 at last. Arguments are handled in the manner of fmt.Print.
func (*Logger) Warn ¶
func (l *Logger) Warn(v ...interface{})
Warn calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.