Documentation ¶
Overview ¶
Package xLog offers simple cross platform logging for Windows and Linux. Available logging endpoints are event log (Windows), syslog (Linux), and an io.Writer.
Index ¶
- func Close()
- func Error(v ...interface{})
- func ErrorDepth(depth int, v ...interface{})
- func Errorf(format string, v ...interface{})
- func Errorln(v ...interface{})
- func Fatal(v ...interface{})
- func FatalDepth(depth int, v ...interface{})
- func Fatalf(format string, v ...interface{})
- func Fatalln(v ...interface{})
- func Info(v ...interface{})
- func InfoDepth(depth int, v ...interface{})
- func Infof(format string, v ...interface{})
- func Infoln(v ...interface{})
- func SetFlags(flag int)
- func Trace(v ...interface{})
- func TraceDepth(depth int, v ...interface{})
- func Tracef(format string, v ...interface{})
- func Traceln(v ...interface{})
- func Warning(v ...interface{})
- func WarningDepth(depth int, v ...interface{})
- func Warningf(format string, v ...interface{})
- func Warningln(v ...interface{})
- type Logger
- func (l *Logger) Close()
- func (l *Logger) Error(v ...interface{})
- func (l *Logger) ErrorDepth(depth int, 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) FatalDepth(depth int, v ...interface{})
- func (l *Logger) Fatalf(format string, v ...interface{})
- func (l *Logger) Fatalln(v ...interface{})
- func (l *Logger) Info(v ...interface{})
- func (l *Logger) InfoDepth(depth int, v ...interface{})
- func (l *Logger) Infof(format string, v ...interface{})
- func (l *Logger) Infoln(v ...interface{})
- func (l *Logger) Trace(v ...interface{})
- func (l *Logger) TraceDepth(depth int, v ...interface{})
- func (l *Logger) Tracef(format string, v ...interface{})
- func (l *Logger) Traceln(v ...interface{})
- func (l *Logger) Warning(v ...interface{})
- func (l *Logger) WarningDepth(depth int, v ...interface{})
- func (l *Logger) Warningf(format string, v ...interface{})
- func (l *Logger) Warningln(v ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(v ...interface{})
Error uses the default logger and logs with the Error log_level. Arguments are handled in the manner of fmt.Print.
func ErrorDepth ¶
func ErrorDepth(depth int, v ...interface{})
ErrorDepth acts as Error but uses depth to determine which call frame to log. ErrorDepth(0, "msg") is the same as Error("msg").
func Errorf ¶
func Errorf(format string, v ...interface{})
Errorf uses the default logger and logs with the Error log_level. Arguments are handled in the manner of fmt.Printf.
func Errorln ¶
func Errorln(v ...interface{})
Errorln uses the default logger and logs with the Error log_level. Arguments are handled in the manner of fmt.Println.
func Fatal ¶
func Fatal(v ...interface{})
Fatalln uses the default logger, logs with the Fatal log_level, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Print.
func FatalDepth ¶
func FatalDepth(depth int, v ...interface{})
FatalDepth acts as Fatal but uses depth to determine which call frame to log. FatalDepth(0, "msg") is the same as Fatal("msg").
func Fatalf ¶
func Fatalf(format string, v ...interface{})
Fatalf uses the default logger, logs with the Fatal log_level, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Printf.
func Fatalln ¶
func Fatalln(v ...interface{})
Fatalln uses the default logger, logs with the Fatal log_level, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Println.
func Info ¶
func Info(v ...interface{})
Info uses the default logger and logs with the Info log_level. Arguments are handled in the manner of fmt.Print.
func InfoDepth ¶
func InfoDepth(depth int, v ...interface{})
InfoDepth acts as Info but uses depth to determine which call frame to log. InfoDepth(0, "msg") is the same as Info("msg").
func Infof ¶
func Infof(format string, v ...interface{})
Infof uses the default logger and logs with the Info log_level. Arguments are handled in the manner of fmt.Printf.
func Infoln ¶
func Infoln(v ...interface{})
Infoln uses the default logger and logs with the Info log_level. Arguments are handled in the manner of fmt.Println.
func Trace ¶
func Trace(v ...interface{})
Trace uses the default logger and logs with the eTrace log_level. Arguments are handled in the manner of fmt.Print.
func TraceDepth ¶
func TraceDepth(depth int, v ...interface{})
TraceDepth acts as Trace but uses depth to determine which call frame to log. TraceDepth(0, "msg") is the same as Trace("msg").
func Tracef ¶
func Tracef(format string, v ...interface{})
Tracef uses the default logger and logs with the eTrace log_level. Arguments are handled in the manner of fmt.Printf.
func Traceln ¶
func Traceln(v ...interface{})
Traceln uses the default logger and logs with the eTrace log_level. Arguments are handled in the manner of fmt.Println.
func Warning ¶
func Warning(v ...interface{})
Warning uses the default logger and logs with the Warning log_level. Arguments are handled in the manner of fmt.Print.
func WarningDepth ¶
func WarningDepth(depth int, v ...interface{})
WarningDepth acts as Warning but uses depth to determine which call frame to log. WarningDepth(0, "msg") is the same as Warning("msg").
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
A Logger represents an active logging object. Multiple loggers can be used simultaneously even if they are using the same same writers.
func Init ¶
Init sets up logging and should be called before log functions, usually in the caller's main(). Default log functions can be called before Init(), but log output will only go to stderr (along with a warning). The first call to Init populates the default logger and returns the generated logger, subsequent calls to Init will only return the generated logger. If the logFile passed in also satisfies io.Closer, logFile.Close will be called when closing the logger.
func (*Logger) Close ¶
func (l *Logger) Close()
Close closes all the underlying log writers, which will flush any cached logs. Any errors from closing the underlying log writers will be printed to stderr. Once Close is called, all future calls to the logger will panic.
func (*Logger) Error ¶
func (l *Logger) Error(v ...interface{})
Error logs with the ERROR log_level. Arguments are handled in the manner of fmt.Print.
func (*Logger) ErrorDepth ¶
ErrorDepth acts as Error but uses depth to determine which call frame to log. ErrorDepth(0, "msg") is the same as Error("msg").
func (*Logger) Errorf ¶
Errorf logs with the Error log_level. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Errorln ¶
func (l *Logger) Errorln(v ...interface{})
Errorln logs with the ERROR log_level. Arguments are handled in the manner of fmt.Println.
func (*Logger) Fatal ¶
func (l *Logger) Fatal(v ...interface{})
Fatal logs with the Fatal log_level, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Print.
func (*Logger) FatalDepth ¶
FatalDepth acts as Fatal but uses depth to determine which call frame to log. FatalDepth(0, "msg") is the same as Fatal("msg").
func (*Logger) Fatalf ¶
Fatalf logs with the Fatal log_level, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Printf.
func (*Logger) Fatalln ¶
func (l *Logger) Fatalln(v ...interface{})
Fatalln logs with the Fatal log_level, and ends with os.Exit(1). Arguments are handled in the manner of fmt.Println.
func (*Logger) Info ¶
func (l *Logger) Info(v ...interface{})
Info logs with the Info log_level. Arguments are handled in the manner of fmt.Print.
func (*Logger) InfoDepth ¶
InfoDepth acts as Info but uses depth to determine which call frame to log. InfoDepth(0, "msg") is the same as Info("msg").
func (*Logger) Infof ¶
Infof logs with the Info log_level. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Infoln ¶
func (l *Logger) Infoln(v ...interface{})
Infoln logs with the Info log_level. Arguments are handled in the manner of fmt.Println.
func (*Logger) Trace ¶
func (l *Logger) Trace(v ...interface{})
Trace logs with the eTrace log_level. Arguments are handled in the manner of fmt.Print.
func (*Logger) TraceDepth ¶
TraceDepth acts as Trace but uses depth to determine which call frame to log. TraceDepth(0, "msg") is the same as Trace("msg").
func (*Logger) Tracef ¶
Tracef logs with the eTrace log_level. Arguments are handled in the manner of fmt.Printf.
func (*Logger) Traceln ¶
func (l *Logger) Traceln(v ...interface{})
Traceln logs with the eTrace log_level. Arguments are handled in the manner of fmt.Println.
func (*Logger) Warning ¶
func (l *Logger) Warning(v ...interface{})
Warning logs with the Warning log_level. Arguments are handled in the manner of fmt.Print.
func (*Logger) WarningDepth ¶
WarningDepth acts as Warning but uses depth to determine which call frame to log. WarningDepth(0, "msg") is the same as Warning("msg").