Add new BindJSON method to a logger

This commit is contained in:
9seconds
2021-10-04 10:10:14 +03:00
parent 706aef8ca1
commit dbaa743e03
5 changed files with 20 additions and 1 deletions
+3
View File
@@ -245,6 +245,9 @@ type Logger interface {
// BindStr binds new string parameter to a new logger instance.
BindStr(name, value string) Logger
// BindJSON binds a new JSON-encoded string to a new logger instance.
BindJSON(name, value string) Logger
// Printf is to support log.Logger behavior.
Printf(format string, args ...interface{})
+1
View File
@@ -11,6 +11,7 @@ type NoopLogger struct{}
func (n NoopLogger) Named(_ string) Logger { return n }
func (n NoopLogger) BindInt(_ string, _ int) Logger { return n }
func (n NoopLogger) BindStr(_, _ string) Logger { return n }
func (n NoopLogger) BindJSON(_, _ string) Logger { return n }
func (n NoopLogger) Printf(_ string, _ ...interface{}) {}
func (n NoopLogger) Info(_ string) {}
func (n NoopLogger) Warning(_ string) {}