|
@ -58,7 +58,7 @@ func TestVariousLevels(t *testing.T) { |
|
|
tc := tc |
|
|
tc := tc |
|
|
t.Run(tc.name, func(t *testing.T) { |
|
|
t.Run(tc.name, func(t *testing.T) { |
|
|
var buf bytes.Buffer |
|
|
var buf bytes.Buffer |
|
|
logger := log.NewFilter(log.NewTMJSONLogger(&buf), tc.allowed) |
|
|
|
|
|
|
|
|
logger := log.NewFilter(log.NewTMJSONLoggerNoTS(&buf), tc.allowed) |
|
|
|
|
|
|
|
|
logger.Debug("here", "this is", "debug log") |
|
|
logger.Debug("here", "this is", "debug log") |
|
|
logger.Info("here", "this is", "info log") |
|
|
logger.Info("here", "this is", "info log") |
|
@ -74,7 +74,7 @@ func TestVariousLevels(t *testing.T) { |
|
|
func TestLevelContext(t *testing.T) { |
|
|
func TestLevelContext(t *testing.T) { |
|
|
var buf bytes.Buffer |
|
|
var buf bytes.Buffer |
|
|
|
|
|
|
|
|
logger := log.NewTMJSONLogger(&buf) |
|
|
|
|
|
|
|
|
logger := log.NewTMJSONLoggerNoTS(&buf) |
|
|
logger = log.NewFilter(logger, log.AllowError()) |
|
|
logger = log.NewFilter(logger, log.AllowError()) |
|
|
logger = logger.With("context", "value") |
|
|
logger = logger.With("context", "value") |
|
|
|
|
|
|
|
@ -96,7 +96,7 @@ func TestLevelContext(t *testing.T) { |
|
|
func TestVariousAllowWith(t *testing.T) { |
|
|
func TestVariousAllowWith(t *testing.T) { |
|
|
var buf bytes.Buffer |
|
|
var buf bytes.Buffer |
|
|
|
|
|
|
|
|
logger := log.NewTMJSONLogger(&buf) |
|
|
|
|
|
|
|
|
logger := log.NewTMJSONLoggerNoTS(&buf) |
|
|
|
|
|
|
|
|
logger1 := log.NewFilter(logger, log.AllowError(), log.AllowInfoWith("context", "value")) |
|
|
logger1 := log.NewFilter(logger, log.AllowError(), log.AllowInfoWith("context", "value")) |
|
|
logger1.With("context", "value").Info("foo", "bar", "baz") |
|
|
logger1.With("context", "value").Info("foo", "bar", "baz") |
|
|