Documentation ¶
Overview ¶
Package log is used to initialize the logger.
Package log is used to initialize the logger. This package should be imported once, usually from main, then call GetLogger.
Index ¶
- Constants
- func PrintCWConfig(jsonConfig string, log T) string
- type ContextFormatFilter
- type FormatFilter
- type Mock
- func (_m *Mock) Close()
- func (_m *Mock) Critical(v ...interface{}) error
- func (_m *Mock) Criticalf(format string, params ...interface{}) error
- func (_m *Mock) Debug(v ...interface{})
- func (_m *Mock) Debugf(format string, params ...interface{})
- func (_m *Mock) Error(v ...interface{}) error
- func (_m *Mock) Errorf(format string, params ...interface{}) error
- func (_m *Mock) Flush()
- func (_m *Mock) Info(v ...interface{})
- func (_m *Mock) Infof(format string, params ...interface{})
- func (_m *Mock) Trace(v ...interface{})
- func (_m *Mock) Tracef(format string, params ...interface{})
- func (_m *Mock) Warn(v ...interface{}) error
- func (_m *Mock) Warnf(format string, params ...interface{}) error
- type T
- type Wrapper
- func (w Wrapper) Close()
- func (w Wrapper) Critical(v ...interface{}) error
- func (w Wrapper) Criticalf(format string, params ...interface{}) error
- func (w Wrapper) Debug(v ...interface{})
- func (w Wrapper) Debugf(format string, params ...interface{})
- func (w Wrapper) Error(v ...interface{}) error
- func (w Wrapper) Errorf(format string, params ...interface{}) error
- func (w Wrapper) Flush()
- func (w Wrapper) Info(v ...interface{})
- func (w Wrapper) Infof(format string, params ...interface{})
- func (w Wrapper) Trace(v ...interface{})
- func (w Wrapper) Tracef(format string, params ...interface{})
- func (w Wrapper) Warn(v ...interface{}) error
- func (w Wrapper) Warnf(format string, params ...interface{}) error
Constants ¶
const ( LogFile = "amazon-ssm-agent.log" ErrorFile = "errors.log" )
const ( // DefaultSeelogConfigFilePath specifies the default seelog location // The underlying logger is based of https://github.com/cihub/seelog // See Seelog documentation to customize the logger DefaultSeelogConfigFilePath = "/etc/amazon/ssm/seelog.xml" DefaultLogDir = "/var/log/amazon/ssm" )
Variables ¶
This section is empty.
Functions ¶
func PrintCWConfig ¶
PrintCWConfig checks if the config file has credentials and returns a string with the credentials removed, for printing
Types ¶
type ContextFormatFilter ¶
type ContextFormatFilter struct {
Context []string
}
ContextFormatFilter is a filter that can add a context to the parameters of a log message.
func (ContextFormatFilter) Filter ¶
func (f ContextFormatFilter) Filter(params ...interface{}) (newParams []interface{})
Filter adds the context at the beginning of the parameter slice.
func (ContextFormatFilter) Filterf ¶
func (f ContextFormatFilter) Filterf(format string, params ...interface{}) (newFormat string, newParams []interface{})
Filterf adds the context in from of the format string.
type FormatFilter ¶
type FormatFilter interface { // Filter modifies parameters that will be passed to log.Debug, log.Info, etc. Filter(params ...interface{}) (newParams []interface{}) // Filter modifies format and/or parameter strings that will be passed to log.Debugf, log.Infof, etc. Filterf(format string, params ...interface{}) (newFormat string, newParams []interface{}) }
FormatFilter can modify the format and or parameters to be passed to a logger.
type Mock ¶
Mock stands for a mocked log.
func NewMockLog ¶
func NewMockLog() *Mock
NewMockLogger returns an instance of Mock with default expectations set.
type T ¶
type T interface { // Tracef formats message according to format specifier // and writes to log with level Trace. Tracef(format string, params ...interface{}) // Debugf formats message according to format specifier // and writes to log with level Debug. Debugf(format string, params ...interface{}) // Infof formats message according to format specifier // and writes to log with level Info. Infof(format string, params ...interface{}) // Warnf formats message according to format specifier // and writes to log with level Warn. Warnf(format string, params ...interface{}) error // Errorf formats message according to format specifier // and writes to log with level Error. Errorf(format string, params ...interface{}) error // Criticalf formats message according to format specifier // and writes to log with level Critical. Criticalf(format string, params ...interface{}) error // Trace formats message using the default formats for its operands // and writes to log with level Trace. Trace(v ...interface{}) // Debug formats message using the default formats for its operands // and writes to log with level Debug. Debug(v ...interface{}) // Info formats message using the default formats for its operands // and writes to log with level Info. Info(v ...interface{}) // Warn formats message using the default formats for its operands // and writes to log with level Warn. Warn(v ...interface{}) error // Error formats message using the default formats for its operands // and writes to log with level Error. Error(v ...interface{}) error // Critical formats message using the default formats for its operands // and writes to log with level Critical. Critical(v ...interface{}) error // Flush flushes all the messages in the logger. Flush() // Close flushes all the messages in the logger and closes it. The logger cannot be used after this operation. Close() }
T represents structs capable of logging messages.
func GetUpdaterLogger ¶
GetUpdaterLogger loads logger for agent updater
func Logger ¶
func Logger() T
Logger loads logger based on the application configuration. it returns the loaded version, if any exists.
func WithContext ¶
WithContext creates a logger that includes the given context with every log message.
type Wrapper ¶
type Wrapper struct { Format FormatFilter Delegate T M *sync.Mutex }
Wrapper is a logger that can modify the format of a log message before delegating to another logger.
func (Wrapper) Close ¶
func (w Wrapper) Close()
Close flushes all the messages in the logger and closes it. It cannot be used after this operation.
func (Wrapper) Critical ¶
Critical formats message using the default formats for its operands and writes to log with level = Critical
func (Wrapper) Criticalf ¶
Criticalf formats message according to format specifier and writes to log with level = Critical.
func (Wrapper) Debug ¶
func (w Wrapper) Debug(v ...interface{})
Debug formats message using the default formats for its operands and writes to log with level = Debug
func (Wrapper) Debugf ¶
Debugf formats message according to format specifier and writes to log with level = Debug.
func (Wrapper) Error ¶
Error formats message using the default formats for its operands and writes to log with level = Error
func (Wrapper) Errorf ¶
Errorf formats message according to format specifier and writes to log with level = Error.
func (Wrapper) Info ¶
func (w Wrapper) Info(v ...interface{})
Info formats message using the default formats for its operands and writes to log with level = Info
func (Wrapper) Infof ¶
Infof formats message according to format specifier and writes to log with level = Info.
func (Wrapper) Trace ¶
func (w Wrapper) Trace(v ...interface{})
Trace formats message using the default formats for its operands and writes to log with level = Trace
func (Wrapper) Tracef ¶
Tracef formats message according to format specifier and writes to log with level = Trace.