Documentation
¶
Index ¶
- Constants
- Variables
- func AssembleMsg(depth int, logLevel, msg string, err error, keysAndValues ...interface{}) string
- func Debug(msg string, keysAndValues ...interface{})
- func Error(err error, msg string, keysAndValues ...interface{})
- func Info(msg string, keysAndValues ...interface{})
- func ResetGlobalLogger(log Logger) error
- func SetGlobalLoggerLevel(l Level)
- func Warn(msg string, keysAndValues ...interface{})
- type DefaultLogger
- type Level
- type Logger
Constants ¶
View Source
const ( // RecordLogFileName represents the default file name of the record log. RecordLogFileName = "sentinel-record.log" DefaultDirName = "logs" + string(os.PathSeparator) + "csp" + string(os.PathSeparator) GlobalCallerDepth = 4 )
Variables ¶
View Source
var (
FrequentErrorOnce = &sync.Once{}
)
Functions ¶
func AssembleMsg ¶ added in v1.0.0
func ResetGlobalLogger ¶ added in v0.6.0
Note: Not thread-safe
func SetGlobalLoggerLevel ¶
func SetGlobalLoggerLevel(l Level)
Types ¶
type DefaultLogger ¶ added in v0.6.0
type DefaultLogger struct {
// contains filtered or unexported fields
}
sentinel general logger
func (*DefaultLogger) Debug ¶ added in v0.6.0
func (l *DefaultLogger) Debug(msg string, keysAndValues ...interface{})
func (*DefaultLogger) Error ¶ added in v0.6.0
func (l *DefaultLogger) Error(err error, msg string, keysAndValues ...interface{})
func (*DefaultLogger) Info ¶ added in v0.6.0
func (l *DefaultLogger) Info(msg string, keysAndValues ...interface{})
func (*DefaultLogger) Warn ¶ added in v0.6.0
func (l *DefaultLogger) Warn(msg string, keysAndValues ...interface{})
type Level ¶
type Level uint8
Level represents the level of logging.
func GetGlobalLoggerLevel ¶
func GetGlobalLoggerLevel() Level
type Logger ¶
type Logger interface { Debug(msg string, keysAndValues ...interface{}) // 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{}) Warn(msg string, keysAndValues ...interface{}) Error(err error, msg string, keysAndValues ...interface{}) }
func NewConsoleLogger ¶
func NewConsoleLogger() Logger
func NewSimpleFileLogger ¶
outputFile is the full path(absolute path)
Click to show internal directories.
Click to hide internal directories.