MCPcopy
hub / github.com/uber-go/zap / getMessage

Function getMessage

sugar.go:372–387  ·  view source on GitHub ↗

getMessage format with Sprint, Sprintf, or neither.

(template string, fmtArgs []interface{})

Source from the content-addressed store, hash-verified

370
371// getMessage format with Sprint, Sprintf, or neither.
372func getMessage(template string, fmtArgs []interface{}) string {
373 if len(fmtArgs) == 0 {
374 return template
375 }
376
377 if template != "" {
378 return fmt.Sprintf(template, fmtArgs...)
379 }
380
381 if len(fmtArgs) == 1 {
382 if str, ok := fmtArgs[0].(string); ok {
383 return str
384 }
385 }
386 return fmt.Sprint(fmtArgs...)
387}
388
389// getMessageln format with Sprintln.
390func getMessageln(fmtArgs []interface{}) string {

Callers 1

logMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected