summaryrefslogtreecommitdiffstats
path: root/plugin/hclog_adapter.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/hclog_adapter.go')
-rw-r--r--plugin/hclog_adapter.go36
1 files changed, 31 insertions, 5 deletions
diff --git a/plugin/hclog_adapter.go b/plugin/hclog_adapter.go
index c8e39877e..55d60f508 100644
--- a/plugin/hclog_adapter.go
+++ b/plugin/hclog_adapter.go
@@ -6,6 +6,7 @@ package plugin
import (
"fmt"
"log"
+ "strings"
"github.com/hashicorp/go-hclog"
"github.com/mattermost/mattermost-server/mlog"
@@ -17,23 +18,48 @@ type HclogAdapter struct {
}
func (h *HclogAdapter) Trace(msg string, args ...interface{}) {
- h.wrappedLogger.Debug(msg, mlog.String(h.extrasKey, fmt.Sprintln(args...)))
+ extras := strings.TrimSpace(fmt.Sprint(args...))
+ if extras != "" {
+ h.wrappedLogger.Debug(msg, mlog.String(h.extrasKey, extras))
+ } else {
+ h.wrappedLogger.Debug(msg)
+ }
}
func (h *HclogAdapter) Debug(msg string, args ...interface{}) {
- h.wrappedLogger.Debug(msg, mlog.String(h.extrasKey, fmt.Sprintln(args...)))
+ extras := strings.TrimSpace(fmt.Sprint(args...))
+ if extras != "" {
+ h.wrappedLogger.Debug(msg, mlog.String(h.extrasKey, extras))
+ } else {
+ h.wrappedLogger.Debug(msg)
+ }
}
func (h *HclogAdapter) Info(msg string, args ...interface{}) {
- h.wrappedLogger.Info(msg, mlog.String(h.extrasKey, fmt.Sprintln(args...)))
+ extras := strings.TrimSpace(fmt.Sprint(args...))
+ if extras != "" {
+ h.wrappedLogger.Info(msg, mlog.String(h.extrasKey, extras))
+ } else {
+ h.wrappedLogger.Info(msg)
+ }
}
func (h *HclogAdapter) Warn(msg string, args ...interface{}) {
- h.wrappedLogger.Warn(msg, mlog.String(h.extrasKey, fmt.Sprintln(args...)))
+ extras := strings.TrimSpace(fmt.Sprint(args...))
+ if extras != "" {
+ h.wrappedLogger.Warn(msg, mlog.String(h.extrasKey, extras))
+ } else {
+ h.wrappedLogger.Warn(msg)
+ }
}
func (h *HclogAdapter) Error(msg string, args ...interface{}) {
- h.wrappedLogger.Error(msg, mlog.String(h.extrasKey, fmt.Sprintln(args...)))
+ extras := strings.TrimSpace(fmt.Sprint(args...))
+ if extras != "" {
+ h.wrappedLogger.Error(msg, mlog.String(h.extrasKey, extras))
+ } else {
+ h.wrappedLogger.Error(msg)
+ }
}
func (h *HclogAdapter) IsTrace() bool {