Skip to content
Snippets Groups Projects
Commit c7a00ac2 authored by Jan Semmelink's avatar Jan Semmelink
Browse files

Add trace level to logger to eliminate excessive long messages

parent d25f8523
No related branches found
No related tags found
1 merge request!8More cleanup, remove clutter, add to api-logs, sqs-logs possible, action list in api-logs, runtime control possible
......@@ -76,3 +76,11 @@ func Debugf(format string, args ...interface{}) {
func Debug(args ...interface{}) {
globalLogger.log(LevelDebug, 1, fmt.Sprint(args...))
}
func Tracef(format string, args ...interface{}) {
globalLogger.log(LevelTrace, 1, fmt.Sprintf(format, args...))
}
func Trace(args ...interface{}) {
globalLogger.log(LevelTrace, 1, fmt.Sprint(args...))
}
......@@ -16,6 +16,8 @@ func (level Level) String() string {
return "info"
case LevelDebug:
return "debug"
case LevelTrace:
return "trace"
}
return fmt.Sprintf("Level(%d)", level)
}
......@@ -30,4 +32,5 @@ const (
LevelWarn
LevelInfo
LevelDebug
LevelTrace
)
......@@ -20,6 +20,8 @@ type Logger interface {
Info(args ...interface{})
Debugf(format string, args ...interface{})
Debug(args ...interface{})
Tracef(format string, args ...interface{})
Trace(args ...interface{})
WithFields(data map[string]interface{}) logger
}
......@@ -87,6 +89,14 @@ func (l logger) Debug(args ...interface{}) {
l.log(LevelDebug, 1, fmt.Sprint(args...))
}
func (l logger) Tracef(format string, args ...interface{}) {
l.log(LevelTrace, 1, fmt.Sprintf(format, args...))
}
func (l logger) Trace(args ...interface{}) {
l.log(LevelTrace, 1, fmt.Sprint(args...))
}
func (l logger) log(level Level, skip int, msg string) {
if level <= l.level && l.writer != nil {
entry := Entry{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment