Documentation ¶
Index ¶
- Constants
- func Close()
- func Debugf(format string, args ...interface{})
- func Errorf(format string, args ...interface{})
- func GetLogDirectory() string
- func Logf(format string, args ...interface{})
- func Printf(format string, args ...interface{})
- func Request(tag string, request interface{}, err error)
- func Response(tag string, response interface{}, returnCode int, returnStr string, err error)
- func SetLevel(level int)
- func SetLogFileLimits(maxFileSize int, maxFileCount int)
- func SetName(name string)
- func SetTargetLogDirectory(target int, logDirectory string) error
- type Logger
- func (logger *Logger) Close()
- func (logger *Logger) Debugf(format string, args ...interface{})
- func (logger *Logger) Errorf(format string, args ...interface{})
- func (logger *Logger) GetLogDirectory() string
- func (logger *Logger) Logf(format string, args ...interface{})
- func (logger *Logger) Printf(format string, args ...interface{})
- func (logger *Logger) Request(tag string, request interface{}, err error)
- func (logger *Logger) Response(tag string, response interface{}, returnCode int, returnStr string, err error)
- func (logger *Logger) ResponseEx(tag string, request interface{}, response interface{}, returnCode int, ...)
- func (logger *Logger) SetLevel(level int)
- func (logger *Logger) SetLogFileLimits(maxFileSize int, maxFileCount int)
- func (logger *Logger) SetName(name string)
- func (logger *Logger) SetTarget(target int) error
- func (logger *Logger) SetTargetLogDirectory(target int, logDirectory string) error
- func (logger *Logger) Warnf(format string, args ...interface{})
Constants ¶
const ( LevelAlert = iota LevelError LevelWarning LevelInfo LevelDebug )
Log level
const ( TargetStderr = iota TargetSyslog TargetLogfile TargetStdout TargetStdOutAndLogFile )
Log target
const (
// LogPath is the path where log files are stored.
LogPath = "/var/log/"
)
Variables ¶
This section is empty.
Functions ¶
func GetLogDirectory ¶
func GetLogDirectory() string
func Printf ¶
func Printf(format string, args ...interface{})
Printf logs to the local log and send the log through the channel.
func SetLogFileLimits ¶
func SetTargetLogDirectory ¶
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger object
func NewLoggerE ¶
NewLoggerE creates a new Logger and surfaces any errors encountered during the process. The returned logger is guaranteed to be safe to use when a non-nil error is returned, but may have undesired behavior. Callers should treat the logger as nil under error conditions unless necessary for backwards compatibility reasons.
func (*Logger) Errorf ¶
Errorf logs a formatted string at info level and sends the string to TelemetryBuffer.
func (*Logger) GetLogDirectory ¶
GetLogDirectory gets the directory location where logs should be stored.
func (*Logger) Response ¶
func (logger *Logger) Response(tag string, response interface{}, returnCode int, returnStr string, err error)
Response logs a structured response.
func (*Logger) ResponseEx ¶
func (logger *Logger) ResponseEx(tag string, request interface{}, response interface{}, returnCode int, returnStr string, err error)
ResponseEx logs a structured response and the request associate with it.
func (*Logger) SetLogFileLimits ¶
SetLogFileLimits sets the log file limits.
func (*Logger) SetTargetLogDirectory ¶
SetTargetLogDirectory sets the directory location where logs should be stored along with the target