mirror of https://github.com/sirupsen/logrus.git
make file name comparison os independant
This commit is contained in:
parent
d2654b752f
commit
5a78c38d0e
|
@ -5,6 +5,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
@ -347,7 +348,7 @@ func TestNestedLoggingReportsCorrectCaller(t *testing.T) {
|
||||||
"github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"])
|
"github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"])
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, cwd+"/logrus_test.go:339", fields["file"])
|
assert.Equal(t, filepath.ToSlash(cwd+"/logrus_test.go:340"), filepath.ToSlash(fields["file"].(string)))
|
||||||
|
|
||||||
buffer.Reset()
|
buffer.Reset()
|
||||||
|
|
||||||
|
@ -376,7 +377,7 @@ func TestNestedLoggingReportsCorrectCaller(t *testing.T) {
|
||||||
assert.Equal(t,
|
assert.Equal(t,
|
||||||
"github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"])
|
"github.com/sirupsen/logrus_test.TestNestedLoggingReportsCorrectCaller", fields["func"])
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
assert.Equal(t, cwd+"/logrus_test.go:364", fields["file"])
|
assert.Equal(t, filepath.ToSlash(cwd+"/logrus_test.go:365"), filepath.ToSlash(fields["file"].(string)))
|
||||||
|
|
||||||
logger.ReportCaller = false // return to default value
|
logger.ReportCaller = false // return to default value
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue