From 7c86628f3b6d77c1b3833e1f75a979690aed5f30 Mon Sep 17 00:00:00 2001 From: Christian Schwarz Date: Sun, 24 Sep 2017 19:39:44 +0200 Subject: [PATCH] logger: json serialization of log level is a string --- logger/datastructures.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/logger/datastructures.go b/logger/datastructures.go index fc0ff5c..dd62b2e 100644 --- a/logger/datastructures.go +++ b/logger/datastructures.go @@ -2,6 +2,7 @@ package logger import ( "context" + "encoding/json" "fmt" "github.com/pkg/errors" "time" @@ -9,6 +10,10 @@ import ( type Level int +func (l Level) MarshalJSON() ([]byte, error) { + return json.Marshal(l.String()) +} + const ( Debug Level = iota Info