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 ¶
- func IsValidLogLevel(l string) bool
- type LoggingClient
- type MockLogger
- func (lc MockLogger) Debug(msg string, args ...interface{})
- func (lc MockLogger) Error(msg string, args ...interface{})
- func (lc MockLogger) Info(msg string, args ...interface{})
- func (lc MockLogger) SetLogLevel(loglevel string) error
- func (lc MockLogger) Trace(msg string, args ...interface{})
- func (lc MockLogger) Warn(msg string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidLogLevel ¶
IsValidLogLevel checks if `l` is a valid log level
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 // 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{}) }
LoggingClient defines the interface for logging operations.
func NewClient ¶
func NewClient(owningServiceName string, isRemote bool, logTarget string, logLevel string) LoggingClient
NewClient creates an instance of LoggingClient
func NewClientStdOut ¶
func NewClientStdOut(owningServiceName string, isRemote bool, logLevel string) LoggingClient
NewClientStdOut creates an instance of LoggingClient that expects to log to stdout and does not check logTarget
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(msg string, args ...interface{})
Debug simulates logging an entry at the DEBUG severity level
func (MockLogger) Error ¶
func (lc MockLogger) Error(msg string, args ...interface{})
Error simulates logging an entry at the ERROR severity level
func (MockLogger) Info ¶
func (lc MockLogger) Info(msg string, args ...interface{})
Info simulates logging an entry at the INFO severity level
func (MockLogger) SetLogLevel ¶
func (lc MockLogger) SetLogLevel(loglevel string) error
SetLogLevel simulates setting a log severity level
func (MockLogger) Trace ¶
func (lc MockLogger) Trace(msg string, args ...interface{})
Trace simulates logging an entry at the TRACE severity level
func (MockLogger) Warn ¶
func (lc MockLogger) Warn(msg string, args ...interface{})
Warn simulates logging an entry at the WARN severity level