Skip to content

Commit

Permalink
unexport RelativeFilePathPrettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Minter committed Jan 21, 2020
1 parent aad460a commit a55e862
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions pkg/util/log/log.go
Expand Up @@ -21,14 +21,13 @@ func GetLogger() *logrus.Entry {
logrus.SetReportCaller(true)
logrus.SetFormatter(&logrus.TextFormatter{
FullTimestamp: true,
CallerPrettyfier: RelativeFilePathPrettier,
CallerPrettyfier: relativeFilePathPrettier,
})

return logrus.NewEntry(logrus.StandardLogger())
}

// RelativeFilePathPrettier changes absolute paths with relative paths
func RelativeFilePathPrettier(f *runtime.Frame) (string, string) {
func relativeFilePathPrettier(f *runtime.Frame) (string, string) {
file := strings.TrimPrefix(f.File, repopath)
function := f.Function[strings.LastIndexByte(f.Function, '/')+1:]
return fmt.Sprintf("%s()", function), fmt.Sprintf(" %s:%d", file, f.Line)
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/log/log_test.go
Expand Up @@ -48,7 +48,7 @@ func TestRelativeFilePathPrettier(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
function, file := RelativeFilePathPrettier(tt.f)
function, file := relativeFilePathPrettier(tt.f)
if function != tt.wantFunction {
t.Error(function)
}
Expand Down

0 comments on commit a55e862

Please sign in to comment.