File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,10 @@ package logtest
1818
1919import (
2020 "context"
21+ "fmt"
2122 "io/ioutil"
23+ "path/filepath"
24+ "runtime"
2225 "testing"
2326
2427 "github.com/containerd/containerd/log"
@@ -35,13 +38,17 @@ func WithT(ctx context.Context, t testing.TB) context.Context {
3538 // Increase debug level for tests
3639 l .SetLevel (logrus .DebugLevel )
3740 l .SetOutput (ioutil .Discard )
41+ l .SetReportCaller (true )
3842
3943 // Add testing hook
4044 l .AddHook (& testHook {
4145 t : t ,
4246 fmt : & logrus.TextFormatter {
4347 DisableColors : true ,
4448 TimestampFormat : log .RFC3339NanoFixed ,
49+ CallerPrettyfier : func (frame * runtime.Frame ) (string , string ) {
50+ return filepath .Base (frame .Function ), fmt .Sprintf ("%s:%d" , frame .File , frame .Line )
51+ },
4552 },
4653 })
4754
You can’t perform that action at this time.
0 commit comments