Documentation
¶
Index ¶
- type DefaultLogger
- func (l *DefaultLogger) Debug(msg string, rest ...interface{})
- func (l *DefaultLogger) Debugf(format string, args ...interface{})
- func (l *DefaultLogger) Error(msg string, rest ...interface{})
- func (l *DefaultLogger) Errorf(msg string, args ...interface{})
- func (l *DefaultLogger) Fatal(msg string, rest ...interface{})
- func (l *DefaultLogger) Fatalf(msg string, args ...interface{})
- func (l *DefaultLogger) Info(msg string, rest ...interface{})
- func (l *DefaultLogger) Infof(msg string, args ...interface{})
- func (l *DefaultLogger) Panicf(msg string, args ...interface{})
- func (l *DefaultLogger) SetDebug(junk bool)
- func (l *DefaultLogger) SetLogFile(junk string)
- func (l *DefaultLogger) Warn(msg string, rest ...interface{})
- func (l *DefaultLogger) Warnf(msg string, args ...interface{})
- func (l *DefaultLogger) WithFields(_ Fields) ILogger
- type Fields
- type ILogger
- type Logger
- func (l *Logger) Debug(msg string, rest ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(msg string, rest ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(msg string, rest ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(msg string, rest ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) Panicf(format string, args ...interface{})
- func (l *Logger) SetDebug(flag bool)
- func (l *Logger) SetLogFile(file string)
- func (l *Logger) Warn(msg string, rest ...interface{})
- func (l *Logger) Warnf(format string, args ...interface{})
- func (l *Logger) WithFields(fields Fields) ILogger
- type MockLogger
- func (l *MockLogger) Debug(msg string, rest ...interface{})
- func (l *MockLogger) Debugf(msg string, rest ...interface{})
- func (l *MockLogger) Error(msg string, rest ...interface{})
- func (l *MockLogger) Errorf(msg string, rest ...interface{})
- func (l *MockLogger) Fatal(msg string, rest ...interface{})
- func (l *MockLogger) Fatalf(msg string, rest ...interface{})
- func (l *MockLogger) Info(msg string, rest ...interface{})
- func (l *MockLogger) Infof(msg string, rest ...interface{})
- func (l *MockLogger) Panicf(msg string, rest ...interface{})
- func (l *MockLogger) SetDebug(junk bool)
- func (l *MockLogger) SetLogFile(junk string)
- func (l *MockLogger) Warn(msg string, rest ...interface{})
- func (l *MockLogger) Warnf(msg string, rest ...interface{})
- func (l *MockLogger) WithFields(_ Fields) ILogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultLogger ¶
type DefaultLogger struct { }
Default logging structure.
This is a simple implementation of the `ILogger` interface that simply redirects messages to `log.Printf`.
It is used in the same way as the main `Logger` implementation.
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(msg string, rest ...interface{})
Write a debug message to the log.
func (*DefaultLogger) Debugf ¶ added in v0.1.1
func (l *DefaultLogger) Debugf(format string, args ...interface{})
Write a debug message to the log.
func (*DefaultLogger) Error ¶ added in v0.3.0
func (l *DefaultLogger) Error(msg string, rest ...interface{})
Write an error message to the log.
func (*DefaultLogger) Errorf ¶ added in v0.1.1
func (l *DefaultLogger) Errorf(msg string, args ...interface{})
Write an error message to the log and then exit.
func (*DefaultLogger) Fatal ¶
func (l *DefaultLogger) Fatal(msg string, rest ...interface{})
Write a fatal message to the log and then exit.
func (*DefaultLogger) Fatalf ¶ added in v0.1.1
func (l *DefaultLogger) Fatalf(msg string, args ...interface{})
Write a fatal message to the log and then exit.
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(msg string, rest ...interface{})
Write an information message to the log.
func (*DefaultLogger) Infof ¶ added in v0.1.1
func (l *DefaultLogger) Infof(msg string, args ...interface{})
Write an information message to the log.
func (*DefaultLogger) Panicf ¶ added in v0.1.1
func (l *DefaultLogger) Panicf(msg string, args ...interface{})
Write a fatal message to the log and then exit.
func (*DefaultLogger) SetLogFile ¶
func (l *DefaultLogger) SetLogFile(junk string)
Set the log file to use.
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(msg string, rest ...interface{})
Write a warning message to the log.
func (*DefaultLogger) Warnf ¶ added in v0.1.1
func (l *DefaultLogger) Warnf(msg string, args ...interface{})
Write a warning message to the log.
func (*DefaultLogger) WithFields ¶ added in v0.1.1
func (l *DefaultLogger) WithFields(_ Fields) ILogger
type ILogger ¶
type ILogger interface { SetDebug(bool) SetLogFile(string) Debug(string, ...interface{}) Error(string, ...interface{}) Warn(string, ...interface{}) Info(string, ...interface{}) Fatal(string, ...interface{}) Debugf(string, ...interface{}) Warnf(string, ...interface{}) Infof(string, ...interface{}) Fatalf(string, ...interface{}) Errorf(string, ...interface{}) Panicf(string, ...interface{}) WithFields(Fields) ILogger }
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logging structure.
To use,
1) Create a logger:
lgr := logger.NewLogger("/path/to/log")
2) Do things with it:
lgr.Warn("Not enough coffee!") lgr.Info("Water is heating up.") // and so on.
If an empty string is passed to `NewLogger`, then the log facility will display messages on standard output.
func NewLoggerWithFile ¶
Create a new logger with the given log file.
func (*Logger) SetDebug ¶
Set debug mode.
Debug mode is a production-friendly runtime mode that will print human-readable messages to standard output instead of the defined log file.
func (*Logger) WithFields ¶ added in v0.1.1
type MockLogger ¶
Mock logger for Go testing framework.
To use, be sure to set `Test` to your test's `testing.T` instance.
func (*MockLogger) Debug ¶
func (l *MockLogger) Debug(msg string, rest ...interface{})
Write a debug message to the log.
func (*MockLogger) Debugf ¶ added in v0.1.1
func (l *MockLogger) Debugf(msg string, rest ...interface{})
Write a debug message to the log.
func (*MockLogger) Error ¶ added in v0.3.0
func (l *MockLogger) Error(msg string, rest ...interface{})
Write an error message to the log.
func (*MockLogger) Errorf ¶ added in v0.1.1
func (l *MockLogger) Errorf(msg string, rest ...interface{})
Write a fatal message to the log and then exit.
func (*MockLogger) Fatal ¶
func (l *MockLogger) Fatal(msg string, rest ...interface{})
Write a fatal message to the log and then exit.
func (*MockLogger) Fatalf ¶ added in v0.1.1
func (l *MockLogger) Fatalf(msg string, rest ...interface{})
Write a fatal message to the log and then exit.
func (*MockLogger) Info ¶
func (l *MockLogger) Info(msg string, rest ...interface{})
Write an information message to the log.
func (*MockLogger) Infof ¶ added in v0.1.1
func (l *MockLogger) Infof(msg string, rest ...interface{})
Write an information message to the log.
func (*MockLogger) Panicf ¶ added in v0.1.1
func (l *MockLogger) Panicf(msg string, rest ...interface{})
Write a fatal message to the log and then exit.
func (*MockLogger) SetLogFile ¶
func (l *MockLogger) SetLogFile(junk string)
Set the log file to use.
func (*MockLogger) Warn ¶
func (l *MockLogger) Warn(msg string, rest ...interface{})
Write a warning message to the log.
func (*MockLogger) Warnf ¶ added in v0.1.1
func (l *MockLogger) Warnf(msg string, rest ...interface{})
Write a warning message to the log.
func (*MockLogger) WithFields ¶ added in v0.1.1
func (l *MockLogger) WithFields(_ Fields) ILogger