@@ -22,7 +22,6 @@ import (
2222
2323 "github.com/cockroachdb/cockroach/pkg/cli/exit"
2424 "github.com/cockroachdb/cockroach/pkg/util/log/channel"
25- "github.com/cockroachdb/cockroach/pkg/util/log/logpb"
2625 "github.com/cockroachdb/cockroach/pkg/util/log/severity"
2726 "github.com/cockroachdb/cockroach/pkg/util/syncutil"
2827 "github.com/cockroachdb/errors"
@@ -248,36 +247,35 @@ func SetTenantIDs(tenantID string, sqlInstanceID int32) {
248247// outputLogEntry marshals a log entry proto into bytes, and writes
249248// the data to the log files. If a trace location is set, stack traces
250249// are added to the entry before marshaling.
251- func (l * loggerT ) outputLogEntry (entry logpb. Entry ) {
250+ func (l * loggerT ) outputLogEntry (entry logEntry ) {
252251 if f , ok := logging .interceptor .Load ().(InterceptorFn ); ok && f != nil {
253- f (entry )
252+ f (entry . convertToLegacy () )
254253 return
255254 }
256255
257256 // Mark the logger as active, so that further configuration changes
258257 // are disabled. See IsActive() and its callers for details.
259258 setActive ()
260- var stacks []byte
261259 var fatalTrigger chan struct {}
262260 extraSync := false
263261
264- if entry .Severity == severity .FATAL {
262+ if entry .sev == severity .FATAL {
265263 extraSync = true
266264 logging .signalFatalCh ()
267265
268266 switch traceback {
269267 case tracebackSingle :
270- stacks = getStacks (false )
268+ entry . stacks = getStacks (false )
271269 case tracebackAll :
272- stacks = getStacks (true )
270+ entry . stacks = getStacks (true )
273271 }
274272
275273 for _ , s := range l .sinkInfos {
276- stacks = s .sink .attachHints (stacks )
274+ entry . stacks = s .sink .attachHints (entry . stacks )
277275 }
278276
279277 // Explain to the (human) user that we would like to hear from them.
280- stacks = append (stacks , []byte (fatalErrorPostamble )... )
278+ entry . stacks = append (entry . stacks , []byte (fatalErrorPostamble )... )
281279
282280 // We don't want to hang forever writing our final log message. If
283281 // things are broken (for example, if the disk fills up and there
@@ -296,7 +294,7 @@ func (l *loggerT) outputLogEntry(entry logpb.Entry) {
296294 logging .mu .Lock ()
297295 if logging .mu .exitOverride .f != nil {
298296 if logging .mu .exitOverride .hideStack {
299- stacks = []byte ("stack trace omitted via SetExitFunc()\n " )
297+ entry . stacks = []byte ("stack trace omitted via SetExitFunc()\n " )
300298 }
301299 exitFunc = logging .mu .exitOverride .f
302300 }
@@ -337,17 +335,21 @@ func (l *loggerT) outputLogEntry(entry logpb.Entry) {
337335 // Stopper's Stop() call (e.g. the pgwire async processing
338336 // goroutine). These asynchronous log calls are concurrent with
339337 // the stderrSinkInfo update in (*TestLogScope).Close().
340- if entry .Severity < s .threshold .Get () || ! s .sink .active () {
338+ if entry .sev < s .threshold .Get () || ! s .sink .active () {
341339 continue
342340 }
343- editedEntry := maybeRedactEntry ( entry , s . editor )
341+ editedEntry := entry
344342
345343 // Add a counter. This is important for e.g. the SQL audit logs.
346344 // Note: whether the counter is displayed or not depends on
347345 // the formatter.
348- editedEntry .Counter = atomic .AddUint64 (& s .msgCount , 1 )
346+ editedEntry .counter = atomic .AddUint64 (& s .msgCount , 1 )
349347
350- bufs .b [i ] = s .formatter .formatEntry (editedEntry , stacks )
348+ // Process the redation spec.
349+ editedEntry .payload = maybeRedactEntry (editedEntry .payload , s .editor )
350+
351+ // Format the entry for this sink.
352+ bufs .b [i ] = s .formatter .formatEntry (editedEntry )
351353 someSinkActive = true
352354 }
353355
@@ -398,7 +400,7 @@ func (l *loggerT) outputLogEntry(entry logpb.Entry) {
398400 }
399401
400402 // Flush and exit on fatal logging.
401- if entry .Severity == severity .FATAL {
403+ if entry .sev == severity .FATAL {
402404 close (fatalTrigger )
403405 // Note: although it seems like the function is allowed to return
404406 // below when s == severity.FATAL, this is not so, because the
0 commit comments