MCPcopy
hub / github.com/duke-git/lancet / Format

Method Format

xerror/stack.go:121–141  ·  view source on GitHub ↗

Format of frame formats the frame according to the fmt.Formatter interface. %s source file %d source line %n function name %v equivalent to %s:%d Format accepts flags that alter the printing of some verbs, as follows: %+s function name and path of source file relative to the co

(s fmt.State, verb rune)

Source from the content-addressed store, hash-verified

119// GOPATH separated by \n\t (<funcname>\n\t<path>)
120// %+v equivalent to %+s:%d
121func (f frame) Format(s fmt.State, verb rune) {
122 switch verb {
123 case 's':
124 switch {
125 case s.Flag('+'):
126 _, _ = io.WriteString(s, f.name())
127 _, _ = io.WriteString(s, "\n\t")
128 _, _ = io.WriteString(s, f.file())
129 default:
130 _, _ = io.WriteString(s, path.Base(f.file()))
131 }
132 case 'd':
133 _, _ = io.WriteString(s, strconv.Itoa(f.line()))
134 case 'n':
135 _, _ = io.WriteString(s, funcname(f.name()))
136 case 'v':
137 f.Format(s, 's')
138 _, _ = io.WriteString(s, ":")
139 f.Format(s, 'd')
140 }
141}
142
143// MarshalText formats a stacktrace Frame as a text string. The output is the
144// same as that of fmt.Sprintf("%+v", f), but without newlines or tabs.

Callers 15

FormatMethod · 0.45
formatSliceMethod · 0.45
GetNowDateFunction · 0.45
GetNowTimeFunction · 0.45
GetNowDateTimeFunction · 0.45
GetTodayStartTimeFunction · 0.45
GetTodayEndTimeFunction · 0.45
GetZeroHourTimestampFunction · 0.45
FormatTimeToStrFunction · 0.45
NowDateOrTimeFunction · 0.45
GenerateDatetimesBetweenFunction · 0.45
ExampleAddDayFunction · 0.45

Calls 4

nameMethod · 0.95
fileMethod · 0.95
lineMethod · 0.95
funcnameFunction · 0.85

Tested by 15

ExampleAddDayFunction · 0.36
ExampleAddWeekFunction · 0.36
ExampleAddMonthFunction · 0.36
ExampleAddHourFunction · 0.36
ExampleAddMinuteFunction · 0.36
ExampleAddYearFunction · 0.36
ExampleAddDaySafeFunction · 0.36
ExampleAddMonthSafeFunction · 0.36
ExampleAddYearSafeFunction · 0.36
ExampleGetNowDateFunction · 0.36
ExampleGetNowTimeFunction · 0.36
ExampleGetNowDateTimeFunction · 0.36