| 1 | package logrus_testscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.13 bytes/" |
| 5 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/" |
| 6 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 7 | "io/ioutilscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/" |
| 8 | "osscip-go gomod github.com/golang/go/src go1.13 os/" |
| 9 | "path/filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/" |
| 10 | "runtimescip-go gomod github.com/golang/go/src go1.13 runtime/" |
| 11 | "syncscip-go gomod github.com/golang/go/src go1.13 sync/" |
| 12 | "testingscip-go gomod github.com/golang/go/src go1.13 testing/" |
| 13 | "timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 14 | |
| 15 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/" |
| 16 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/" |
| 17 | |
| 18 | . "github.com/sirupsen/logrusscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/" |
| 19 | . "github.com/sirupsen/logrus/internal/testutilsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/" |
| 20 | ) |
| 21 | |
| 22 | // TestReportCaller verifies that when ReportCaller is set, the 'func' field |
| 23 | // is added, and when it is unset it is not set or modified |
| 24 | // Verify that functions within the Logrus package aren't considered when |
| 25 | // discovering the caller. |
| 26 | func TestReportCallerWhenConfiguredscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestReportCallerWhenConfigured().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 27 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 28 | log.ReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReportCaller. = false |
| 29 | log.Printscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Print().("testNoCaller") |
| 30 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 31 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "testNoCaller", fields["msg"]) |
| 32 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "info", fields["level"]) |
| 33 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, nil, fields["func"]) |
| 34 | }) |
| 35 | |
| 36 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 37 | log.ReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReportCaller. = true |
| 38 | log.Printscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Print().("testWithCaller") |
| 39 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 40 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "testWithCaller", fields["msg"]) |
| 41 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "info", fields["level"]) |
| 42 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, |
| 43 | "github.com/sirupsen/logrus_test.TestReportCallerWhenConfigured.func3", fields[FieldKeyFuncscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FieldKeyFunc.]) |
| 44 | }) |
| 45 | |
| 46 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 47 | log.ReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReportCaller. = true |
| 48 | log.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter..(*JSONFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#).CallerPrettyfierscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#CallerPrettyfier. = func(f *runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.Framescip-go gomod github.com/golang/go/src go1.13 runtime/Frame#) (string, string) { |
| 49 | return "somekindoffunc", "thisisafilename" |
| 50 | } |
| 51 | log.Printscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Print().("testWithCallerPrettyfier") |
| 52 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 53 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "somekindoffunc", fields[FieldKeyFuncscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FieldKeyFunc.]) |
| 54 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "thisisafilename", fields[FieldKeyFilescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FieldKeyFile.]) |
| 55 | }) |
| 56 | |
| 57 | LogAndAssertTextscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertText().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 58 | log.ReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReportCaller. = true |
| 59 | log.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter..(*TextFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#).CallerPrettyfierscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#CallerPrettyfier. = func(f *runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.Framescip-go gomod github.com/golang/go/src go1.13 runtime/Frame#) (string, string) { |
| 60 | return "somekindoffunc", "thisisafilename" |
| 61 | } |
| 62 | log.Printscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Print().("testWithCallerPrettyfier") |
| 63 | }, func(fields map[string]string) { |
| 64 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "somekindoffunc", fields[FieldKeyFuncscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FieldKeyFunc.]) |
| 65 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "thisisafilename", fields[FieldKeyFilescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FieldKeyFile.]) |
| 66 | }) |
| 67 | } |
| 68 | |
| 69 | func logSomethingscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/logSomething().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#, message string) Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields# { |
| 70 | var buffer bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 71 | var fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields# |
| 72 | |
| 73 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 74 | logger.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = &buffer |
| 75 | logger.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter. = new(JSONFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#) |
| 76 | logger.ReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReportCaller. = true |
| 77 | |
| 78 | entry := logger.WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{ |
| 79 | "foo": "bar", |
| 80 | }) |
| 81 | |
| 82 | entry.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().(message) |
| 83 | |
| 84 | err := jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &fields) |
| 85 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 86 | |
| 87 | return fields |
| 88 | } |
| 89 | |
| 90 | // TestReportCallerHelperDirect - verify reference when logging from a regular function |
| 91 | func TestReportCallerHelperDirectscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestReportCallerHelperDirect().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 92 | fields := logSomethingscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/logSomething().(t, "direct") |
| 93 | |
| 94 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "direct", fields["msg"]) |
| 95 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "info", fields["level"]) |
| 96 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Regexpscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Regexp().(t, "github.com/.*/logrus_test.logSomething", fields["func"]) |
| 97 | } |
| 98 | |
| 99 | // TestReportCallerHelperDirect - verify reference when logging from a function called via pointer |
| 100 | func TestReportCallerHelperViaPointerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestReportCallerHelperViaPointer().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 101 | fptr := logSomethingscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/logSomething(). |
| 102 | fields := fptr(t, "via pointer") |
| 103 | |
| 104 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "via pointer", fields["msg"]) |
| 105 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "info", fields["level"]) |
| 106 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Regexpscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Regexp().(t, "github.com/.*/logrus_test.logSomething", fields["func"]) |
| 107 | } |
| 108 | |
| 109 | func TestPrintscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestPrint().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 110 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 111 | log.Printscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Print().("test") |
| 112 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 113 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test", fields["msg"]) |
| 114 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "info", fields["level"]) |
| 115 | }) |
| 116 | } |
| 117 | |
| 118 | func TestInfoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestInfo().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 119 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 120 | log.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Info().("test") |
| 121 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 122 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test", fields["msg"]) |
| 123 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "info", fields["level"]) |
| 124 | }) |
| 125 | } |
| 126 | |
| 127 | func TestWarnscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestWarn().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 128 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 129 | log.Warnscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Warn().("test") |
| 130 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 131 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test", fields["msg"]) |
| 132 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "warning", fields["level"]) |
| 133 | }) |
| 134 | } |
| 135 | |
| 136 | func TestLogscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestLog().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 137 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 138 | log.Logscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Log().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel., "test") |
| 139 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 140 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test", fields["msg"]) |
| 141 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "warning", fields["level"]) |
| 142 | }) |
| 143 | } |
| 144 | |
| 145 | func TestInfolnShouldAddSpacesBetweenStringsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestInfolnShouldAddSpacesBetweenStrings().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 146 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 147 | log.Infolnscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Infoln().("test", "test") |
| 148 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 149 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test test", fields["msg"]) |
| 150 | }) |
| 151 | } |
| 152 | |
| 153 | func TestInfolnShouldAddSpacesBetweenStringAndNonstringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestInfolnShouldAddSpacesBetweenStringAndNonstring().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 154 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 155 | log.Infolnscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Infoln().("test", 10) |
| 156 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 157 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test 10", fields["msg"]) |
| 158 | }) |
| 159 | } |
| 160 | |
| 161 | func TestInfolnShouldAddSpacesBetweenTwoNonStringsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestInfolnShouldAddSpacesBetweenTwoNonStrings().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 162 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 163 | log.Infolnscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Infoln().(10, 10) |
| 164 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 165 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "10 10", fields["msg"]) |
| 166 | }) |
| 167 | } |
| 168 | |
| 169 | func TestInfoShouldAddSpacesBetweenTwoNonStringsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestInfoShouldAddSpacesBetweenTwoNonStrings().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 170 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 171 | log.Infolnscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Infoln().(10, 10) |
| 172 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 173 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "10 10", fields["msg"]) |
| 174 | }) |
| 175 | } |
| 176 | |
| 177 | func TestInfoShouldNotAddSpacesBetweenStringAndNonstringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestInfoShouldNotAddSpacesBetweenStringAndNonstring().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 178 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 179 | log.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Info().("test", 10) |
| 180 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 181 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test10", fields["msg"]) |
| 182 | }) |
| 183 | } |
| 184 | |
| 185 | func TestInfoShouldNotAddSpacesBetweenStringsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestInfoShouldNotAddSpacesBetweenStrings().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 186 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 187 | log.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Info().("test", "test") |
| 188 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 189 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "testtest", fields["msg"]) |
| 190 | }) |
| 191 | } |
| 192 | |
| 193 | func TestWithFieldsShouldAllowAssignmentsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestWithFieldsShouldAllowAssignments().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 194 | var buffer bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 195 | var fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields# |
| 196 | |
| 197 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 198 | logger.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = &buffer |
| 199 | logger.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter. = new(JSONFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#) |
| 200 | |
| 201 | localLog := logger.WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{ |
| 202 | "key1": "value1", |
| 203 | }) |
| 204 | |
| 205 | localLog.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WithField().("key2", "value2").Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("test") |
| 206 | err := jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &fields) |
| 207 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 208 | |
| 209 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "value2", fields["key2"]) |
| 210 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "value1", fields["key1"]) |
| 211 | |
| 212 | buffer = bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#{} |
| 213 | fields = Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{} |
| 214 | localLog.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("test") |
| 215 | err = jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &fields) |
| 216 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 217 | |
| 218 | _, ok := fields["key2"] |
| 219 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, ok) |
| 220 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "value1", fields["key1"]) |
| 221 | } |
| 222 | |
| 223 | func TestUserSuppliedFieldDoesNotOverwriteDefaultsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestUserSuppliedFieldDoesNotOverwriteDefaults().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 224 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 225 | log.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("msg", "hello").Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("test") |
| 226 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 227 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test", fields["msg"]) |
| 228 | }) |
| 229 | } |
| 230 | |
| 231 | func TestUserSuppliedMsgFieldHasPrefixscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestUserSuppliedMsgFieldHasPrefix().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 232 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 233 | log.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("msg", "hello").Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("test") |
| 234 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 235 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "test", fields["msg"]) |
| 236 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "hello", fields["fields.msg"]) |
| 237 | }) |
| 238 | } |
| 239 | |
| 240 | func TestUserSuppliedTimeFieldHasPrefixscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestUserSuppliedTimeFieldHasPrefix().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 241 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 242 | log.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("time", "hello").Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("test") |
| 243 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 244 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "hello", fields["fields.time"]) |
| 245 | }) |
| 246 | } |
| 247 | |
| 248 | func TestUserSuppliedLevelFieldHasPrefixscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestUserSuppliedLevelFieldHasPrefix().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 249 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 250 | log.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("level", 1).Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("test") |
| 251 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 252 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "info", fields["level"]) |
| 253 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, 1.0, fields["fields.level"]) // JSON has floats only |
| 254 | }) |
| 255 | } |
| 256 | |
| 257 | func TestDefaultFieldsAreNotPrefixedscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestDefaultFieldsAreNotPrefixed().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 258 | LogAndAssertTextscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertText().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 259 | ll := log.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("herp", "derp") |
| 260 | ll.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("hello") |
| 261 | ll.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("bye") |
| 262 | }, func(fields map[string]string) { |
| 263 | for _, fieldName := range []string{"fields.level", "fields.time", "fields.msg"} { |
| 264 | if _, ok := fields[fieldName]; ok { |
| 265 | t.Fatalfscip-go gomod github.com/golang/go/src go1.13 testing/common#Fatalf().("should not have prefixed %q: %v", fieldName, fields) |
| 266 | } |
| 267 | } |
| 268 | }) |
| 269 | } |
| 270 | |
| 271 | func TestWithTimeShouldOverrideTimescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestWithTimeShouldOverrideTime().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 272 | now := timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().().Addscip-go gomod github.com/golang/go/src go1.13 time/Time#Add().(24 * timescip-go gomod github.com/golang/go/src go1.13 time/.Hourscip-go gomod github.com/golang/go/src go1.13 time/Hour.) |
| 273 | |
| 274 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 275 | log.WithTimescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithTime().(now).Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("foobar") |
| 276 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 277 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["time"], now.Formatscip-go gomod github.com/golang/go/src go1.13 time/Time#Format().(timescip-go gomod github.com/golang/go/src go1.13 time/.RFC3339scip-go gomod github.com/golang/go/src go1.13 time/RFC3339.)) |
| 278 | }) |
| 279 | } |
| 280 | |
| 281 | func TestWithTimeShouldNotOverrideFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestWithTimeShouldNotOverrideFields().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 282 | now := timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().().Addscip-go gomod github.com/golang/go/src go1.13 time/Time#Add().(24 * timescip-go gomod github.com/golang/go/src go1.13 time/.Hourscip-go gomod github.com/golang/go/src go1.13 time/Hour.) |
| 283 | |
| 284 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 285 | log.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("herp", "derp").WithTimescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WithTime().(now).Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("blah") |
| 286 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 287 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["time"], now.Formatscip-go gomod github.com/golang/go/src go1.13 time/Time#Format().(timescip-go gomod github.com/golang/go/src go1.13 time/.RFC3339scip-go gomod github.com/golang/go/src go1.13 time/RFC3339.)) |
| 288 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["herp"], "derp") |
| 289 | }) |
| 290 | } |
| 291 | |
| 292 | func TestWithFieldShouldNotOverrideTimescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestWithFieldShouldNotOverrideTime().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 293 | now := timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().().Addscip-go gomod github.com/golang/go/src go1.13 time/Time#Add().(24 * timescip-go gomod github.com/golang/go/src go1.13 time/.Hourscip-go gomod github.com/golang/go/src go1.13 time/Hour.) |
| 294 | |
| 295 | LogAndAssertJSONscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus/internal/testutils`/LogAndAssertJSON().(t, func(log *Loggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#) { |
| 296 | log.WithTimescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithTime().(now).WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WithField().("herp", "derp").Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("blah") |
| 297 | }, func(fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#) { |
| 298 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["time"], now.Formatscip-go gomod github.com/golang/go/src go1.13 time/Time#Format().(timescip-go gomod github.com/golang/go/src go1.13 time/.RFC3339scip-go gomod github.com/golang/go/src go1.13 time/RFC3339.)) |
| 299 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["herp"], "derp") |
| 300 | }) |
| 301 | } |
| 302 | |
| 303 | func TestTimeOverrideMultipleLogsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestTimeOverrideMultipleLogs().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 304 | var buffer bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 305 | var firstFields, secondFields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields# |
| 306 | |
| 307 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 308 | logger.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = &buffer |
| 309 | formatter := new(JSONFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#) |
| 310 | formatter.TimestampFormatscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#TimestampFormat. = timescip-go gomod github.com/golang/go/src go1.13 time/.StampMilliscip-go gomod github.com/golang/go/src go1.13 time/StampMilli. |
| 311 | logger.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter. = formatter |
| 312 | |
| 313 | llog := logger.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("herp", "derp") |
| 314 | llog.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("foo") |
| 315 | |
| 316 | err := jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &firstFields) |
| 317 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/NoError().(t, err, "should have decoded first message") |
| 318 | |
| 319 | buffer.Resetscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Reset().() |
| 320 | |
| 321 | timescip-go gomod github.com/golang/go/src go1.13 time/.Sleepscip-go gomod github.com/golang/go/src go1.13 time/Sleep().(10 * timescip-go gomod github.com/golang/go/src go1.13 time/.Millisecondscip-go gomod github.com/golang/go/src go1.13 time/Millisecond.) |
| 322 | llog.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("bar") |
| 323 | |
| 324 | err = jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &secondFields) |
| 325 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/NoError().(t, err, "should have decoded second message") |
| 326 | |
| 327 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.NotEqualscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/NotEqual().(t, firstFields["time"], secondFields["time"], "timestamps should not be equal") |
| 328 | } |
| 329 | |
| 330 | func TestDoubleLoggingDoesntPrefixPreviousFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestDoubleLoggingDoesntPrefixPreviousFields().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 331 | |
| 332 | var buffer bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 333 | var fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields# |
| 334 | |
| 335 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 336 | logger.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = &buffer |
| 337 | logger.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter. = new(JSONFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#) |
| 338 | |
| 339 | llog := logger.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("context", "eating raw fish") |
| 340 | |
| 341 | llog.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("looks delicious") |
| 342 | |
| 343 | err := jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &fields) |
| 344 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/NoError().(t, err, "should have decoded first message") |
| 345 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, len(fields), 4, "should only have msg/time/level/context fields") |
| 346 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["msg"], "looks delicious") |
| 347 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["context"], "eating raw fish") |
| 348 | |
| 349 | buffer.Resetscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Reset().() |
| 350 | |
| 351 | llog.Warnscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Warn().("omg it is!") |
| 352 | |
| 353 | err = jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &fields) |
| 354 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/NoError().(t, err, "should have decoded second message") |
| 355 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, len(fields), 4, "should only have msg/time/level/context fields") |
| 356 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "omg it is!", fields["msg"]) |
| 357 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "eating raw fish", fields["context"]) |
| 358 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, fields["fields.msg"], "should not have prefixed previous `msg` entry") |
| 359 | |
| 360 | } |
| 361 | |
| 362 | func TestNestedLoggingReportsCorrectCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestNestedLoggingReportsCorrectCaller().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 363 | var buffer bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 364 | var fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields# |
| 365 | |
| 366 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 367 | logger.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = &buffer |
| 368 | logger.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter. = new(JSONFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#) |
| 369 | logger.ReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReportCaller. = true |
| 370 | |
| 371 | llog := logger.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("context", "eating raw fish") |
| 372 | |
| 373 | llog.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("looks delicious") |
| 374 | _, _, line, _ := runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.Callerscip-go gomod github.com/golang/go/src go1.13 runtime/Caller().(0) |
| 375 | |
| 376 | err := jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &fields) |
| 377 | requirescip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/NoError().(t, err, "should have decoded first message") |
| 378 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, 6, len(fields), "should have msg/time/level/func/context fields") |
| 379 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "looks delicious", fields["msg"]) |
| 380 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "eating raw fish", fields["context"]) |
| 381 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, |
| 382 | "github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"]) |
| 383 | cwd, err := osscip-go gomod github.com/golang/go/src go1.13 os/.Getwdscip-go gomod github.com/golang/go/src go1.13 os/Getwd().() |
| 384 | requirescip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 385 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/ToSlash().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%s/logrus_test.go:%d", cwd, line-1)), filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/ToSlash().(fields["file"].(string))) |
| 386 | |
| 387 | buffer.Resetscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Reset().() |
| 388 | |
| 389 | logger.WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{ |
| 390 | "Clyde": "Stubblefield", |
| 391 | }).WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{ |
| 392 | "Jab'o": "Starks", |
| 393 | }).WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{ |
| 394 | "uri": "https://www.youtube.com/watch?v=V5DTznu-9v0", |
| 395 | }).WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{ |
| 396 | "func": "y drummer", |
| 397 | }).WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{ |
| 398 | "James": "Brown", |
| 399 | }).Printscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Print().("The hardest workin' man in show business") |
| 400 | _, _, line, _ = runtimescip-go gomod github.com/golang/go/src go1.13 runtime/.Callerscip-go gomod github.com/golang/go/src go1.13 runtime/Caller().(0) |
| 401 | |
| 402 | err = jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(buffer.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().(), &fields) |
| 403 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/NoError().(t, err, "should have decoded second message") |
| 404 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, 11, len(fields), "should have all builtin fields plus foo,bar,baz,...") |
| 405 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "Stubblefield", fields["Clyde"]) |
| 406 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "Starks", fields["Jab'o"]) |
| 407 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "https://www.youtube.com/watch?v=V5DTznu-9v0", fields["uri"]) |
| 408 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "y drummer", fields["fields.func"]) |
| 409 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "Brown", fields["James"]) |
| 410 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "The hardest workin' man in show business", fields["msg"]) |
| 411 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, fields["fields.msg"], "should not have prefixed previous `msg` entry") |
| 412 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, |
| 413 | "github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"]) |
| 414 | requirescip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/.NoErrorscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/require`/NoError().(t, err) |
| 415 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/ToSlash().(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%s/logrus_test.go:%d", cwd, line-1)), filepathscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/.ToSlashscip-go gomod github.com/golang/go/src go1.13 `path/filepath`/ToSlash().(fields["file"].(string))) |
| 416 | |
| 417 | logger.ReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReportCaller. = false // return to default value |
| 418 | } |
| 419 | |
| 420 | func logLoopscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/logLoop().(iterations int, reportCaller bool) { |
| 421 | var buffer bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 422 | |
| 423 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 424 | logger.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = &buffer |
| 425 | logger.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter. = new(JSONFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#) |
| 426 | logger.ReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReportCaller. = reportCaller |
| 427 | |
| 428 | for i := 0; i < iterations; i++ { |
| 429 | logger.Infofscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Infof().("round %d of %d", i, iterations) |
| 430 | } |
| 431 | } |
| 432 | |
| 433 | // Assertions for upper bounds to reporting overhead |
| 434 | func TestCallerReportingOverheadscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestCallerReportingOverhead().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 435 | iterations := 5000 |
| 436 | before := timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().() |
| 437 | logLoopscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/logLoop().(iterations, false) |
| 438 | during := timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().() |
| 439 | logLoopscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/logLoop().(iterations, true) |
| 440 | after := timescip-go gomod github.com/golang/go/src go1.13 time/.Nowscip-go gomod github.com/golang/go/src go1.13 time/Now().() |
| 441 | |
| 442 | elapsedNotReporting := during.Subscip-go gomod github.com/golang/go/src go1.13 time/Time#Sub().(before).Nanosecondsscip-go gomod github.com/golang/go/src go1.13 time/Duration#Nanoseconds().() |
| 443 | elapsedReporting := after.Subscip-go gomod github.com/golang/go/src go1.13 time/Time#Sub().(during).Nanosecondsscip-go gomod github.com/golang/go/src go1.13 time/Duration#Nanoseconds().() |
| 444 | |
| 445 | maxDelta := 1 * timescip-go gomod github.com/golang/go/src go1.13 time/.Secondscip-go gomod github.com/golang/go/src go1.13 time/Second. |
| 446 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.WithinDurationscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/WithinDuration().(t, during, before, maxDelta, |
| 447 | "%d log calls without caller name lookup takes less than %d second(s) (was %d nanoseconds)", |
| 448 | iterations, maxDelta.Secondsscip-go gomod github.com/golang/go/src go1.13 time/Duration#Seconds().(), elapsedNotReporting) |
| 449 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.WithinDurationscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/WithinDuration().(t, after, during, maxDelta, |
| 450 | "%d log calls without caller name lookup takes less than %d second(s) (was %d nanoseconds)", |
| 451 | iterations, maxDelta.Secondsscip-go gomod github.com/golang/go/src go1.13 time/Duration#Seconds().(), elapsedReporting) |
| 452 | } |
| 453 | |
| 454 | // benchmarks for both with and without caller-function reporting |
| 455 | func BenchmarkWithoutCallerTracingscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/BenchmarkWithoutCallerTracing().(b *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Bscip-go gomod github.com/golang/go/src go1.13 testing/B#) { |
| 456 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.13 testing/B#N.; i++ { |
| 457 | logLoopscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/logLoop().(1000, false) |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | func BenchmarkWithCallerTracingscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/BenchmarkWithCallerTracing().(b *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Bscip-go gomod github.com/golang/go/src go1.13 testing/B#) { |
| 462 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.13 testing/B#N.; i++ { |
| 463 | logLoopscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/logLoop().(1000, true) |
| 464 | } |
| 465 | } |
| 466 | |
| 467 | func TestConvertLevelToStringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestConvertLevelToString().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 468 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "trace", TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel..Stringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level#String().()) |
| 469 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "debug", DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel..Stringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level#String().()) |
| 470 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "info", InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel..Stringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level#String().()) |
| 471 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "warning", WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel..Stringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level#String().()) |
| 472 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "error", ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel..Stringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level#String().()) |
| 473 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "fatal", FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel..Stringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level#String().()) |
| 474 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "panic", PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel..Stringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level#String().()) |
| 475 | } |
| 476 | |
| 477 | func TestParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestParseLevel().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 478 | l, err := ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("panic") |
| 479 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 480 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel., l) |
| 481 | |
| 482 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("PANIC") |
| 483 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 484 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel., l) |
| 485 | |
| 486 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("fatal") |
| 487 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 488 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel., l) |
| 489 | |
| 490 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("FATAL") |
| 491 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 492 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel., l) |
| 493 | |
| 494 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("error") |
| 495 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 496 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel., l) |
| 497 | |
| 498 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("ERROR") |
| 499 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 500 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel., l) |
| 501 | |
| 502 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("warn") |
| 503 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 504 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel., l) |
| 505 | |
| 506 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("WARN") |
| 507 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 508 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel., l) |
| 509 | |
| 510 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("warning") |
| 511 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 512 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel., l) |
| 513 | |
| 514 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("WARNING") |
| 515 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 516 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel., l) |
| 517 | |
| 518 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("info") |
| 519 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 520 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel., l) |
| 521 | |
| 522 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("INFO") |
| 523 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 524 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel., l) |
| 525 | |
| 526 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("debug") |
| 527 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 528 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel., l) |
| 529 | |
| 530 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("DEBUG") |
| 531 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 532 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel., l) |
| 533 | |
| 534 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("trace") |
| 535 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 536 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel., l) |
| 537 | |
| 538 | l, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("TRACE") |
| 539 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 540 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel., l) |
| 541 | |
| 542 | _, err = ParseLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ParseLevel().("invalid") |
| 543 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, "not a valid logrus Level: \"invalid\"", err.Error()) |
| 544 | } |
| 545 | |
| 546 | func TestLevelStringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestLevelString().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 547 | var loggerlevel Levelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level# |
| 548 | loggerlevel = 32000 |
| 549 | |
| 550 | _ = loggerlevel.Stringscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Level#String().() |
| 551 | } |
| 552 | |
| 553 | func TestGetSetLevelRacescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestGetSetLevelRace().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 554 | wg := syncscip-go gomod github.com/golang/go/src go1.13 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#{} |
| 555 | for i := 0; i < 100; i++ { |
| 556 | wg.Addscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Add().(1) |
| 557 | go func(i int) { |
| 558 | defer wg.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().() |
| 559 | if i%2 == 0 { |
| 560 | SetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/SetLevel().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.) |
| 561 | } else { |
| 562 | GetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/GetLevel().() |
| 563 | } |
| 564 | }(i) |
| 565 | |
| 566 | } |
| 567 | wg.Waitscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Wait().() |
| 568 | } |
| 569 | |
| 570 | func TestLoggingRacescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestLoggingRace().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 571 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 572 | |
| 573 | var wg syncscip-go gomod github.com/golang/go/src go1.13 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup# |
| 574 | wg.Addscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Add().(100) |
| 575 | |
| 576 | for i := 0; i < 100; i++ { |
| 577 | go func() { |
| 578 | logger.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Info().("info") |
| 579 | wg.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().() |
| 580 | }() |
| 581 | } |
| 582 | wg.Waitscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Wait().() |
| 583 | } |
| 584 | |
| 585 | func TestLoggingRaceWithHooksOnEntryscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestLoggingRaceWithHooksOnEntry().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 586 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 587 | hook := new(ModifyHookscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/ModifyHook#) |
| 588 | logger.AddHookscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#AddHook().(hook) |
| 589 | entry := logger.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("context", "clue") |
| 590 | |
| 591 | var ( |
| 592 | wg syncscip-go gomod github.com/golang/go/src go1.13 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup# |
| 593 | mtx syncscip-go gomod github.com/golang/go/src go1.13 sync/.Mutexscip-go gomod github.com/golang/go/src go1.13 sync/Mutex# |
| 594 | start bool |
| 595 | ) |
| 596 | |
| 597 | cond := syncscip-go gomod github.com/golang/go/src go1.13 sync/.NewCondscip-go gomod github.com/golang/go/src go1.13 sync/NewCond().(&mtx) |
| 598 | |
| 599 | wg.Addscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Add().(100) |
| 600 | |
| 601 | for i := 0; i < 50; i++ { |
| 602 | go func() { |
| 603 | cond.Lscip-go gomod github.com/golang/go/src go1.13 sync/Cond#L..Lockscip-go gomod github.com/golang/go/src go1.13 sync/Locker#Lock().() |
| 604 | for !start { |
| 605 | cond.Waitscip-go gomod github.com/golang/go/src go1.13 sync/Cond#Wait().() |
| 606 | } |
| 607 | cond.Lscip-go gomod github.com/golang/go/src go1.13 sync/Cond#L..Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Locker#Unlock().() |
| 608 | for j := 0; j < 100; j++ { |
| 609 | entry.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("info") |
| 610 | } |
| 611 | wg.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().() |
| 612 | }() |
| 613 | } |
| 614 | |
| 615 | for i := 0; i < 50; i++ { |
| 616 | go func() { |
| 617 | cond.Lscip-go gomod github.com/golang/go/src go1.13 sync/Cond#L..Lockscip-go gomod github.com/golang/go/src go1.13 sync/Locker#Lock().() |
| 618 | for !start { |
| 619 | cond.Waitscip-go gomod github.com/golang/go/src go1.13 sync/Cond#Wait().() |
| 620 | } |
| 621 | cond.Lscip-go gomod github.com/golang/go/src go1.13 sync/Cond#L..Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Locker#Unlock().() |
| 622 | for j := 0; j < 100; j++ { |
| 623 | entry.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WithField().("another field", "with some data").Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("info") |
| 624 | } |
| 625 | wg.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().() |
| 626 | }() |
| 627 | } |
| 628 | |
| 629 | cond.Lscip-go gomod github.com/golang/go/src go1.13 sync/Cond#L..Lockscip-go gomod github.com/golang/go/src go1.13 sync/Locker#Lock().() |
| 630 | start = true |
| 631 | cond.Lscip-go gomod github.com/golang/go/src go1.13 sync/Cond#L..Unlockscip-go gomod github.com/golang/go/src go1.13 sync/Locker#Unlock().() |
| 632 | cond.Broadcastscip-go gomod github.com/golang/go/src go1.13 sync/Cond#Broadcast().() |
| 633 | wg.Waitscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Wait().() |
| 634 | } |
| 635 | |
| 636 | func TestReplaceHooksscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestReplaceHooks().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 637 | old, cur := &TestHookscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestHook#{}, &TestHookscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestHook#{} |
| 638 | |
| 639 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 640 | logger.SetOutputscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetOutput().(ioutilscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/.Discardscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/Discard.) |
| 641 | logger.AddHookscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#AddHook().(old) |
| 642 | |
| 643 | hooks := make(LevelHooksscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/LevelHooks#) |
| 644 | hooks.Addscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/LevelHooks#Add().(cur) |
| 645 | replaced := logger.ReplaceHooksscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReplaceHooks().(hooks) |
| 646 | |
| 647 | logger.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Info().("test") |
| 648 | |
| 649 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, old.Firedscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestHook#Fired., false) |
| 650 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, cur.Firedscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestHook#Fired., true) |
| 651 | |
| 652 | logger.ReplaceHooksscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#ReplaceHooks().(replaced) |
| 653 | logger.Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Info().("test") |
| 654 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, old.Firedscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestHook#Fired., true) |
| 655 | } |
| 656 | |
| 657 | // Compile test |
| 658 | func TestLogrusInterfacesscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestLogrusInterfaces().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 659 | var buffer bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 660 | // This verifies FieldLogger and Ext1FieldLogger work as designed. |
| 661 | // Please don't use them. Use Logger and Entry directly. |
| 662 | fn := func(xl Ext1FieldLoggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Ext1FieldLogger#) { |
| 663 | var l FieldLoggerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FieldLogger# = xl |
| 664 | b := l.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FieldLogger#WithField.("key", "value") |
| 665 | b.Debugscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Debug().("Test") |
| 666 | } |
| 667 | // test logger |
| 668 | logger := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 669 | logger.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = &buffer |
| 670 | fn(logger) |
| 671 | |
| 672 | // test Entry |
| 673 | e := logger.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("another", "value") |
| 674 | fn(e) |
| 675 | } |
| 676 | |
| 677 | // Implements io.Writer using channels for synchronization, so we can wait on |
| 678 | // the Entry.Writer goroutine to write in a non-racey way. This does assume that |
| 679 | // there is a single call to Logger.Out for each message. |
| 680 | type channelWriterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/channelWriter# chan []byte |
| 681 | |
| 682 | func (cw channelWriterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/channelWriter#) Writescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/channelWriter#Write().(p []byte) (int, error) { |
| 683 | cw <- p |
| 684 | return len(p), nil |
| 685 | } |
| 686 | |
| 687 | func TestEntryWriterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestEntryWriter().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 688 | cw := channelWriterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/channelWriter#(make(chan []byte, 1)) |
| 689 | log := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 690 | log.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = cw |
| 691 | log.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter. = new(JSONFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/JSONFormatter#) |
| 692 | _, err := log.WithFieldscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithField().("foo", "bar").WriterLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#WriterLevel().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.).Writescip-go gomod github.com/golang/go/src go1.13 io/PipeWriter#Write().([]byte("hello\n")) |
| 693 | if err != nil { |
| 694 | t.Errorscip-go gomod github.com/golang/go/src go1.13 testing/common#Error().("unexecpted error", err) |
| 695 | } |
| 696 | |
| 697 | bs := <-cw |
| 698 | var fields Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields# |
| 699 | err = jsonscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/.Unmarshalscip-go gomod github.com/golang/go/src go1.13 `encoding/json`/Unmarshal().(bs, &fields) |
| 700 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Nil().(t, err) |
| 701 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["foo"], "bar") |
| 702 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, fields["level"], "warning") |
| 703 | } |
| 704 | |
| 705 | func TestLogLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestLogLevelEnabled().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 706 | log := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 707 | log.SetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetLevel().(PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel.) |
| 708 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel.)) |
| 709 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel.)) |
| 710 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel.)) |
| 711 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.)) |
| 712 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.)) |
| 713 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel.)) |
| 714 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel.)) |
| 715 | |
| 716 | log.SetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetLevel().(FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel.) |
| 717 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel.)) |
| 718 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel.)) |
| 719 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel.)) |
| 720 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.)) |
| 721 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.)) |
| 722 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel.)) |
| 723 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel.)) |
| 724 | |
| 725 | log.SetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetLevel().(ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel.) |
| 726 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel.)) |
| 727 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel.)) |
| 728 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel.)) |
| 729 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.)) |
| 730 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.)) |
| 731 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel.)) |
| 732 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel.)) |
| 733 | |
| 734 | log.SetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetLevel().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.) |
| 735 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel.)) |
| 736 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel.)) |
| 737 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel.)) |
| 738 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.)) |
| 739 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.)) |
| 740 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel.)) |
| 741 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel.)) |
| 742 | |
| 743 | log.SetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetLevel().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.) |
| 744 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel.)) |
| 745 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel.)) |
| 746 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel.)) |
| 747 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.)) |
| 748 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.)) |
| 749 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel.)) |
| 750 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel.)) |
| 751 | |
| 752 | log.SetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetLevel().(DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel.) |
| 753 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel.)) |
| 754 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel.)) |
| 755 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel.)) |
| 756 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.)) |
| 757 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.)) |
| 758 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel.)) |
| 759 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, false, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel.)) |
| 760 | |
| 761 | log.SetLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetLevel().(TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel.) |
| 762 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(PanicLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/PanicLevel.)) |
| 763 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(FatalLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/FatalLevel.)) |
| 764 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(ErrorLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/ErrorLevel.)) |
| 765 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(WarnLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/WarnLevel.)) |
| 766 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(InfoLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/InfoLevel.)) |
| 767 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(DebugLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/DebugLevel.)) |
| 768 | assertscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.7.0 `github.com/stretchr/testify/assert`/Equal().(t, true, log.IsLevelEnabledscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#IsLevelEnabled().(TraceLevelscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TraceLevel.)) |
| 769 | } |
| 770 | |
| 771 | func TestReportCallerOnTextFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestReportCallerOnTextFormatter().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 772 | l := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 773 | |
| 774 | l.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter..(*TextFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#).ForceColorsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#ForceColors. = true |
| 775 | l.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter..(*TextFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#).DisableColorsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#DisableColors. = false |
| 776 | l.WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{"func": "func", "file": "file"}).Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("test") |
| 777 | |
| 778 | l.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter..(*TextFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#).ForceColorsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#ForceColors. = false |
| 779 | l.Formatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Formatter..(*TextFormatterscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#).DisableColorsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/TextFormatter#DisableColors. = true |
| 780 | l.WithFieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#WithFields().(Fieldsscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Fields#{"func": "func", "file": "file"}).Infoscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Entry#Info().("test") |
| 781 | } |
| 782 | |
| 783 | func TestSetReportCallerRacescip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus_test`/TestSetReportCallerRace().(t *testingscip-go gomod github.com/golang/go/src go1.13 testing/.Tscip-go gomod github.com/golang/go/src go1.13 testing/T#) { |
| 784 | l := Newscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/New().() |
| 785 | l.Outscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Out. = ioutilscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/.Discardscip-go gomod github.com/golang/go/src go1.13 `io/ioutil`/Discard. |
| 786 | l.SetReportCallerscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#SetReportCaller().(true) |
| 787 | |
| 788 | var wg syncscip-go gomod github.com/golang/go/src go1.13 sync/.WaitGroupscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup# |
| 789 | wg.Addscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Add().(100) |
| 790 | |
| 791 | for i := 0; i < 100; i++ { |
| 792 | go func() { |
| 793 | l.Errorscip-go gomod github.com/sirupsen/logrus . `github.com/sirupsen/logrus`/Logger#Error().("Some Error") |
| 794 | wg.Donescip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Done().() |
| 795 | }() |
| 796 | } |
| 797 | wg.Waitscip-go gomod github.com/golang/go/src go1.13 sync/WaitGroup#Wait().() |
| 798 | } |