MCPcopy
hub / github.com/op/go-logging / Message

Method Message

logger.go:69–89  ·  view source on GitHub ↗

Message returns the log record message.

()

Source from the content-addressed store, hash-verified

67
68// Message returns the log record message.
69func (r *Record) Message() string {
70 if r.message == nil {
71 // Redact the arguments that implements the Redactor interface
72 for i, arg := range r.Args {
73 if redactor, ok := arg.(Redactor); ok == true {
74 r.Args[i] = redactor.Redacted()
75 }
76 }
77 var buf bytes.Buffer
78 if r.fmt != nil {
79 fmt.Fprintf(&buf, *r.fmt, r.Args...)
80 } else {
81 // use Fprintln to make sure we always get space between arguments
82 fmt.Fprintln(&buf, r.Args...)
83 buf.Truncate(buf.Len() - 1) // strip newline
84 }
85 msg := buf.String()
86 r.message = &msg
87 }
88 return *r.message
89}
90
91// Logger is the actual logger which creates log records based on the functions
92// called and passes them to the underlying logging backend.

Callers 1

FormatMethod · 0.80

Calls 2

StringMethod · 0.80
RedactedMethod · 0.65

Tested by

no test coverage detected