Documentation
¶
Overview ¶
Package logger provides a client for integration with the support-logging service. The client can also be configured to write logs to a local file rather than sending them to a service.
Index ¶
- type LoggingClient
- type MockLogger
- func (lc MockLogger) Debug(_ string, _ ...interface{})
- func (lc MockLogger) Debugf(_ string, _ ...interface{})
- func (lc MockLogger) Error(_ string, _ ...interface{})
- func (lc MockLogger) Errorf(_ string, _ ...interface{})
- func (lc MockLogger) Info(_ string, _ ...interface{})
- func (lc MockLogger) Infof(_ string, _ ...interface{})
- func (lc MockLogger) LogLevel() string
- func (lc MockLogger) SetLogLevel(_ string) error
- func (lc MockLogger) Trace(_ string, _ ...interface{})
- func (lc MockLogger) Tracef(_ string, _ ...interface{})
- func (lc MockLogger) Warn(_ string, _ ...interface{})
- func (lc MockLogger) Warnf(_ string, _ ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type LoggingClient ¶
type LoggingClient interface {
// SetLogLevel sets minimum severity log level. If a logging method is called with a lower level of severity than
// what is set, it will result in no output.
SetLogLevel(logLevel string) error
// LogLevel returns the current log level setting
LogLevel() string
// Debug logs a message at the DEBUG severity level
Debug(msg string, args ...interface{})
// Error logs a message at the ERROR severity level
Error(msg string, args ...interface{})
// Info logs a message at the INFO severity level
Info(msg string, args ...interface{})
// Trace logs a message at the TRACE severity level
Trace(msg string, args ...interface{})
// Warn logs a message at the WARN severity level
Warn(msg string, args ...interface{})
// Debugf logs a formatted message at the DEBUG severity level
Debugf(msg string, args ...interface{})
// Errorf logs a formatted message at the ERROR severity level
Errorf(msg string, args ...interface{})
// Infof logs a formatted message at the INFO severity level
Infof(msg string, args ...interface{})
// Tracef logs a formatted message at the TRACE severity level
Tracef(msg string, args ...interface{})
// Warnf logs a formatted message at the WARN severity level
Warnf(msg string, args ...interface{})
}
LoggingClient defines the interface for logging operations.
func NewClient ¶
func NewClient(owningServiceName string, logLevel string) LoggingClient
NewClient creates an instance of LoggingClient
func NewMockClient ¶
func NewMockClient() LoggingClient
NewMockClient creates a mock instance of LoggingClient
type MockLogger ¶
type MockLogger struct {
}
MockLogger is a type that can be used for mocking the LoggingClient interface during unit tests
func (MockLogger) Debug ¶
func (lc MockLogger) Debug(_ string, _ ...interface{})
Debug simulates logging an entry at the DEBUG severity level
func (MockLogger) Debugf ¶
func (lc MockLogger) Debugf(_ string, _ ...interface{})
Debugf simulates logging an formatted message at the DEBUG severity level
func (MockLogger) Error ¶
func (lc MockLogger) Error(_ string, _ ...interface{})
Error simulates logging an entry at the ERROR severity level
func (MockLogger) Errorf ¶
func (lc MockLogger) Errorf(_ string, _ ...interface{})
Errorf simulates logging an formatted message at the ERROR severity level
func (MockLogger) Info ¶
func (lc MockLogger) Info(_ string, _ ...interface{})
Info simulates logging an entry at the INFO severity level
func (MockLogger) Infof ¶
func (lc MockLogger) Infof(_ string, _ ...interface{})
Infof simulates logging an formatted message at the INFO severity level
func (MockLogger) LogLevel ¶
func (lc MockLogger) LogLevel() string
LogLevel returns the current log level setting
func (MockLogger) SetLogLevel ¶
func (lc MockLogger) SetLogLevel(_ string) error
SetLogLevel simulates setting a log severity level
func (MockLogger) Trace ¶
func (lc MockLogger) Trace(_ string, _ ...interface{})
Trace simulates logging an entry at the TRACE severity level
func (MockLogger) Tracef ¶
func (lc MockLogger) Tracef(_ string, _ ...interface{})
Tracef simulates logging an formatted message at the TRACE severity level
func (MockLogger) Warn ¶
func (lc MockLogger) Warn(_ string, _ ...interface{})
Warn simulates logging an entry at the WARN severity level
func (MockLogger) Warnf ¶
func (lc MockLogger) Warnf(_ string, _ ...interface{})
Warnf simulates logging an formatted message at the WARN severity level