File tree Expand file tree Collapse file tree 3 files changed +27
-2
lines changed
Expand file tree Collapse file tree 3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 11package ctxlog
22
3- import "context"
3+ import (
4+ "context"
5+
6+ "github.com/sirupsen/logrus"
7+ )
48
59func (l * CtxLogger ) Error (ctx context.Context , msg string ) {
610 fields := convertFieldsToLogrusFields (getFields (ctx ))
711 l .Log .WithFields (fields ).Error (msg )
812}
13+
14+ func (l * CtxLogger ) ErrorFn (ctx context.Context , logFunc logrus.LogFunction ) {
15+ fields := convertFieldsToLogrusFields (getFields (ctx ))
16+ l .Log .WithFields (fields ).Logger .ErrorFn (logFunc )
17+ }
Original file line number Diff line number Diff line change @@ -2,9 +2,16 @@ package ctxlog
22
33import (
44 "context"
5+
6+ "github.com/sirupsen/logrus"
57)
68
79func (l * CtxLogger ) Info (ctx context.Context , msg string ) {
810 fields := convertFieldsToLogrusFields (getFields (ctx ))
911 l .Log .WithFields (fields ).Info (msg )
1012}
13+
14+ func (l * CtxLogger ) InfoFn (ctx context.Context , logFun logrus.LogFunction ) {
15+ fields := convertFieldsToLogrusFields (getFields (ctx ))
16+ l .Log .WithFields (fields ).InfoFn (logFun )
17+ }
Original file line number Diff line number Diff line change 11package ctxlog
22
3- import "context"
3+ import (
4+ "context"
5+
6+ "github.com/sirupsen/logrus"
7+ )
48
59func (l * CtxLogger ) Warn (ctx context.Context , msg string ) {
610 fields := convertFieldsToLogrusFields (getFields (ctx ))
711 l .Log .WithFields (fields ).Warn (msg )
812}
13+
14+ func (l * CtxLogger ) Warn (ctx context.Context , logFunc logrus.LogFunction ) {
15+ fields := convertFieldsToLogrusFields (getFields (ctx ))
16+ l .Log .WithFields (fields ).WarnFn (logFunc )
17+ }
You can’t perform that action at this time.
0 commit comments