mirror of
https://github.com/retailcrm/api-client-go.git
synced 2024-11-25 14:26:04 +03:00
Neur0toxine
97b1abf470
* refactor library and upgrade version * remove useless environment variable * remove unsupported versions from go.mod * fixes for error handling & data types * different improvements for errors * fixes for types and tests * better coverage, fix error with the unmarshalers
26 lines
708 B
Go
26 lines
708 B
Go
package retailcrm
|
|
|
|
// BasicLogger provides basic functionality for logging.
|
|
type BasicLogger interface {
|
|
Printf(string, ...interface{})
|
|
}
|
|
|
|
// DebugLogger can be used to easily wrap any logger with Debugf method into the BasicLogger instance.
|
|
type DebugLogger interface {
|
|
Debugf(string, ...interface{})
|
|
}
|
|
|
|
type debugLoggerAdapter struct {
|
|
logger DebugLogger
|
|
}
|
|
|
|
// DebugLoggerAdapter returns BasicLogger that calls underlying DebugLogger.Debugf.
|
|
func DebugLoggerAdapter(logger DebugLogger) BasicLogger {
|
|
return &debugLoggerAdapter{logger: logger}
|
|
}
|
|
|
|
// Printf data in the log using DebugLogger.Debugf.
|
|
func (l *debugLoggerAdapter) Printf(format string, v ...interface{}) {
|
|
l.logger.Debugf(format, v...)
|
|
}
|