Skip to content

Commit 28a283d

Browse files
committed
feat: rename CustomCallerPrettyfier option to CustomCallerFormatter
1 parent fea031b commit 28a283d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ type Formatter struct {
3636
// CallerFirst - print caller info first
3737
CallerFirst bool
3838

39-
// CustomCallerPrettyfier - set custom formatter for caller info
40-
CustomCallerPrettyfier func(*runtime.Frame) string
39+
// CustomCallerFormatter - set custom formatter for caller info
40+
CustomCallerFormatter func(*runtime.Frame) string
4141
}
4242
```
4343

formatter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ type Formatter struct {
3737
// CallerFirst - print caller info first
3838
CallerFirst bool
3939

40-
// CustomCallerPrettyfier - set custom formatter for caller info
41-
CustomCallerPrettyfier func(*runtime.Frame) string
40+
// CustomCallerFormatter - set custom formatter for caller info
41+
CustomCallerFormatter func(*runtime.Frame) string
4242
}
4343

4444
// Format an log entry
@@ -108,8 +108,8 @@ func (f *Formatter) Format(entry *logrus.Entry) ([]byte, error) {
108108

109109
func (f *Formatter) writeCaller(b *bytes.Buffer, entry *logrus.Entry) {
110110
if entry.HasCaller() {
111-
if f.CustomCallerPrettyfier != nil {
112-
fmt.Fprintf(b, f.CustomCallerPrettyfier(entry.Caller))
111+
if f.CustomCallerFormatter != nil {
112+
fmt.Fprintf(b, f.CustomCallerFormatter(entry.Caller))
113113
} else {
114114
fmt.Fprintf(
115115
b,

tests/formatter_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ func TestFormatter_Format_with_report_caller_and_CallerFirst_true(t *testing.T)
237237
}
238238
}
239239

240-
func TestFormatter_Format_with_report_caller_and_CustomCallerPrettyfier(t *testing.T) {
240+
func TestFormatter_Format_with_report_caller_and_CustomCallerFormatter(t *testing.T) {
241241
output := bytes.NewBuffer([]byte{})
242242

243243
l := logrus.New()
@@ -247,7 +247,7 @@ func TestFormatter_Format_with_report_caller_and_CustomCallerPrettyfier(t *testi
247247
NoColors: true,
248248
TimestampFormat: "-",
249249
CallerFirst: true,
250-
CustomCallerPrettyfier: func(f *runtime.Frame) string {
250+
CustomCallerFormatter: func(f *runtime.Frame) string {
251251
s := strings.Split(f.Function, ".")
252252
funcName := s[len(s)-1]
253253
return fmt.Sprintf(" [%s:%d][%s()]", path.Base(f.File), f.Line, funcName)

0 commit comments

Comments
 (0)