MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / AuditLogContents

Function AuditLogContents

base/logging.go:446–460  ·  view source on GitHub ↗

AuditLogContents returns that the audit logs produced by function f.

(t testing.TB, f func(t testing.TB))

Source from the content-addressed store, hash-verified

444
445// AuditLogContents returns that the audit logs produced by function f.
446func AuditLogContents(t testing.TB, f func(t testing.TB)) []byte {
447 // Temporarily override logger output
448 b := &bytes.Buffer{}
449 mw := io.MultiWriter(b, os.Stderr)
450 auditLogger.Load().logger.SetOutput(mw)
451
452 // Call the given function
453 f(t)
454
455 FlushLogBuffers()
456 auditLogger.Load().FlushBufferToLog()
457 // do not reset output in defer, since we are accessing b.bytes()
458 auditLogger.Load().logger.SetOutput(os.Stderr)
459 return b.Bytes()
460}

Callers 12

TestAuditLoggingFieldsFunction · 0.92
TestAuditDatabaseUpdateFunction · 0.92
TestEffectiveUserIDFunction · 0.92
TestAuditDocumentReadFunction · 0.92
TestAuditLoggingGlobalsFunction · 0.92
TestDatabaseAuditChangesFunction · 0.92

Calls 3

FlushLogBuffersFunction · 0.85
LoadMethod · 0.80
FlushBufferToLogMethod · 0.80

Tested by 12

TestAuditLoggingFieldsFunction · 0.74
TestAuditDatabaseUpdateFunction · 0.74
TestEffectiveUserIDFunction · 0.74
TestAuditDocumentReadFunction · 0.74
TestAuditLoggingGlobalsFunction · 0.74
TestDatabaseAuditChangesFunction · 0.74