Documentation ¶
Index ¶
- func BufLimit() int64
- func Debug(tag, format string, v ...interface{})
- func Error(tag, format string, v ...interface{})
- func Fatal(tag, format string, v ...interface{})
- func GetWriter(level Level, tag string) io.Writer
- func Info(tag, format string, v ...interface{})
- func Output(level Level, tag string, s string) error
- func Print(level Level, tag string, v ...interface{})
- func Printf(level Level, tag, format string, v ...interface{})
- func Println(level Level, tag string, v ...interface{})
- func SetBufLimit(bufLimit int64)
- func SetLevel(level Level)
- func SetOutput(w io.Writer)
- func Timestamp(level Level, timestamp time.Time, tag, format string, v ...interface{})
- func Trace(tag, format string, v ...interface{})
- func Warn(tag, format string, v ...interface{})
- func Writer() io.Writer
- type Level
- type Logger
- func (l *Logger) BufLimit() int64
- func (l *Logger) Debug(tag, format string, v ...interface{})
- func (l *Logger) Error(tag, format string, v ...interface{})
- func (l *Logger) Fatal(tag, format string, v ...interface{})
- func (l *Logger) GetWriter(level Level, tag string) io.Writer
- func (l *Logger) Info(tag, format string, v ...interface{})
- func (l *Logger) IsLevelEnabled(level Level) bool
- func (l *Logger) Level() Level
- func (l *Logger) Output(level Level, tag, s string) error
- func (l *Logger) Print(level Level, tag string, v ...interface{})
- func (l *Logger) Printf(level Level, tag, format string, v ...interface{})
- func (l *Logger) Println(level Level, tag string, v ...interface{})
- func (l *Logger) SetBufLimit(bufLimit int64)
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) SetOutput(w io.Writer)
- func (l *Logger) Timestamp(level Level, timestamp time.Time, tag, s string) error
- func (l *Logger) TimestampPrintf(level Level, timestamp time.Time, tag, format string, v ...interface{})
- func (l *Logger) Trace(tag, format string, v ...interface{})
- func (l *Logger) Warn(tag, format string, v ...interface{})
- func (l *Logger) Writer() io.Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(tag, format string, v ...interface{})
Debug calls Printf to print to the standard logger with the debug level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.
func Error ¶
func Error(tag, format string, v ...interface{})
Error calls Printf to print to the standard logger with the error level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.
func Fatal ¶
func Fatal(tag, format string, v ...interface{})
Fatal calls Printf to print to the standard logger with the debug level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf. After logging aborting with exit status 1
func GetWriter ¶ added in v1.0.9
GetWriter returns an io.Writer implementation which log all data to the standard logger with log level and tag
func Info ¶
func Info(tag, format string, v ...interface{})
Info calls Printf to print to the standard logger with the info level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.
func Output ¶
Output writes the output for a logging event. The string s contains the text to print after the tag specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline.
func Print ¶
Print calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Print.
func Printf ¶
Printf calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Printf.
func Println ¶
Println calls Output to print to the standard logger. Arguments are handled in the manner of fmt.Println.
func Timestamp ¶ added in v1.0.56
Timestamp calls Printf to print to the standard logger with the trace level and own timestamp. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.
func Trace ¶ added in v1.0.56
func Trace(tag, format string, v ...interface{})
Trace calls Printf to print to the standard logger with the trace level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.
Types ¶
type Level ¶
type Level uint32
Level type
const ( // FatalLevel level. Fatal errors which make it necessary to abort. FatalLevel Level = iota // ErrorLevel level. Used for errors that should definitely be noted. ErrorLevel // WarnLevel level. Non-critical entries that deserve eyes. WarnLevel // InfoLevel level. General operational entries about what's going on inside the application. InfoLevel // DebugLevel level. Output information necessary for debugging. Verbose logging. DebugLevel // TraceLevel level. Enabled when everything should be outputted. Maximum detailed logging. TraceLevel )
These are the different logging levels. You can set the logging level to log on your instance of logger.
func (Level) MarshalText ¶
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 log level is taken from LOG_LEVEL environment variable.
func (*Logger) Debug ¶
Debug calls Printf to print to the standard logger with the debug level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.
func (*Logger) Error ¶
Error calls Printf to print to the standard logger with the error level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.
func (*Logger) Fatal ¶
Fatal calls Printf to print to the standard logger with the debug level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf. After logging aborting with exit status 1
func (*Logger) GetWriter ¶ added in v1.0.9
GetWriter returns an io.Writer implementation which log all data to the standard logger with log level and tag
func (*Logger) Info ¶
Info calls Printf to print to the standard logger with the info level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.
func (*Logger) IsLevelEnabled ¶
IsLevelEnabled checks if the log level of the logger is greater than the level param
func (*Logger) Output ¶
Output writes the output for a logging event. The string s contains the text to print after the tag specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. Output won't write more bytes than bufLimit (if it's set)
func (*Logger) Print ¶
Print calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Print.
func (*Logger) Printf ¶
Printf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Println ¶
Println calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Println.
func (*Logger) SetBufLimit ¶
SetBufLimit sets bufLimit.
func (*Logger) Timestamp ¶ added in v1.0.56
Timestamp writes the output with an own timestamp for a logging event. The string s contains the text to print after the tag specified by the flags of the Logger. A newline is appended if the last character of s is not already a newline. Output won't write more bytes than bufLimit (if it's set)
func (*Logger) TimestampPrintf ¶ added in v1.0.56
func (l *Logger) TimestampPrintf(level Level, timestamp time.Time, tag, format string, v ...interface{})
TimestampPrintf calls l.Output to print to the logger. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Trace ¶ added in v1.0.56
Trace calls Printf to print to the standard logger with the trace level. As tag the app name is taken. Other arguments are handled in the manner of fmt.Printf.