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

Function initializeLoggers

base/logging.go:116–128  ·  view source on GitHub ↗

initializeLoggers should be called once per program in init. This is also called to reset logging in a test context.

(ctx context.Context)

Source from the content-addressed store, hash-verified

114
115// initializeLoggers should be called once per program in init. This is also called to reset logging in a test context.
116func initializeLoggers(ctx context.Context) {
117 nilAllNonConsoleLoggers()
118 // We'll initilise a default consoleLogger so we can still log stuff before/during parsing logging configs.
119 // This maintains consistent formatting (timestamps, levels, etc) in the output,
120 // and allows a single set of logging functions to be used, rather than fmt.Printf()
121
122 // initialCollationBufferSize is set to zero for disabling log collation before
123 // initializing a logging config, and when running under a test scenario.
124 initialCollationBufferSize := 0
125
126 consoleLogger.Store(mustInitConsoleLogger(context.Background(), &ConsoleLoggerConfig{LogKeys: []string{logKeyNames[KeyHTTP]}, FileLoggerConfig: FileLoggerConfig{Enabled: Ptr(true), CollationBufferSize: &initialCollationBufferSize}}))
127 initExternalLoggers()
128}
129
130type logFn func(ctx context.Context, format string, args ...any)
131

Callers 2

initFunction · 0.85
ResetGlobalTestLoggingFunction · 0.85

Calls 5

nilAllNonConsoleLoggersFunction · 0.85
mustInitConsoleLoggerFunction · 0.85
PtrFunction · 0.85
initExternalLoggersFunction · 0.85
StoreMethod · 0.80

Tested by

no test coverage detected