Documentation ¶
Index ¶
- Constants
- Variables
- func AssembleMsg(depth int, logLevel, msg string, err error, keysAndValues ...interface{}) string
- func Debug(msg string, keysAndValues ...interface{})
- func DebugEnabled() bool
- func Error(err error, msg string, keysAndValues ...interface{})
- func ErrorEnabled() bool
- func Info(msg string, keysAndValues ...interface{})
- func InfoEnabled() bool
- func ResetGlobalLogger(log Logger) error
- func ResetGlobalLoggerLevel(l Level)
- func Warn(msg string, keysAndValues ...interface{})
- func WarnEnabled() bool
- type DefaultLogger
- func (l *DefaultLogger) Debug(msg string, keysAndValues ...interface{})
- func (l *DefaultLogger) DebugEnabled() bool
- func (l *DefaultLogger) Error(err error, msg string, keysAndValues ...interface{})
- func (l *DefaultLogger) ErrorEnabled() bool
- func (l *DefaultLogger) Info(msg string, keysAndValues ...interface{})
- func (l *DefaultLogger) InfoEnabled() bool
- func (l *DefaultLogger) Warn(msg string, keysAndValues ...interface{})
- func (l *DefaultLogger) WarnEnabled() bool
- type Level
- type Logger
Constants ¶
View Source
const ( // RecordLogFileName represents the default file name of the record log. RecordLogFileName = "sentinel-record.log" GlobalCallerDepth = 4 )
Variables ¶
View Source
var (
DefaultDirName = filepath.Join("logs", "csp")
)
View Source
var (
FrequentErrorOnce = &sync.Once{}
)
Functions ¶
func AssembleMsg ¶
func DebugEnabled ¶
func DebugEnabled() bool
func ErrorEnabled ¶
func ErrorEnabled() bool
func InfoEnabled ¶
func InfoEnabled() bool
func ResetGlobalLogger ¶
ResetGlobalLogger sets the Sentinel global logger Note: this function is not thread-safe.
func ResetGlobalLoggerLevel ¶
func ResetGlobalLoggerLevel(l Level)
ResetGlobalLoggerLevel sets the Sentinel log level Note: this function is not thread-safe.
func WarnEnabled ¶
func WarnEnabled() bool
Types ¶
type DefaultLogger ¶
type DefaultLogger struct {
// contains filtered or unexported fields
}
sentinel general logger
func (*DefaultLogger) Debug ¶
func (l *DefaultLogger) Debug(msg string, keysAndValues ...interface{})
func (*DefaultLogger) DebugEnabled ¶
func (l *DefaultLogger) DebugEnabled() bool
func (*DefaultLogger) Error ¶
func (l *DefaultLogger) Error(err error, msg string, keysAndValues ...interface{})
func (*DefaultLogger) ErrorEnabled ¶
func (l *DefaultLogger) ErrorEnabled() bool
func (*DefaultLogger) Info ¶
func (l *DefaultLogger) Info(msg string, keysAndValues ...interface{})
func (*DefaultLogger) InfoEnabled ¶
func (l *DefaultLogger) InfoEnabled() bool
func (*DefaultLogger) Warn ¶
func (l *DefaultLogger) Warn(msg string, keysAndValues ...interface{})
func (*DefaultLogger) WarnEnabled ¶
func (l *DefaultLogger) WarnEnabled() bool
type Level ¶
type Level uint8
Level represents the level of logging.
func GetGlobalLoggerLevel ¶
func GetGlobalLoggerLevel() Level
GetGlobalLoggerLevel gets the Sentinel log level
type Logger ¶
type Logger interface { Debug(msg string, keysAndValues ...interface{}) DebugEnabled() bool // Info logs a non-error message with the given key/value pairs as context. // // The msg argument should be used to add some constant description to // the log line. The key/value pairs can then be used to add additional // variable information. The key/value pairs should alternate string // keys and arbitrary values. Info(msg string, keysAndValues ...interface{}) InfoEnabled() bool Warn(msg string, keysAndValues ...interface{}) WarnEnabled() bool Error(err error, msg string, keysAndValues ...interface{}) ErrorEnabled() bool }
func GetGlobalLogger ¶
func GetGlobalLogger() Logger
GetGlobalLogger gets the Sentinel global logger
func NewConsoleLogger ¶
func NewConsoleLogger() Logger
func NewSimpleFileLogger ¶
outputFile is the full path(absolute path)
Click to show internal directories.
Click to hide internal directories.