package
25.1.0+incompatible
Repository: https://github.com/cockroachdb/cockroach.git
Documentation: pkg.go.dev

# Packages

Package eventpb defines standardized payloads for cluster-level and SQL-level event reporting.
Package logconfig manages the configuration of the logging channels and their logging sinks.

# Functions

ApplyConfig applies the given configuration.
DescribeAppliedConfig describes the current setup as effected by ApplyConfig().
DisableTracebacks turns off tracebacks for log.Fatals.
DumpStacks produces a dump of the stack traces in the logging output, and also to stderr if the remainder of the logs don't go to stderr by default.
Error logs to the DEV channel with severity ERROR.
Errorf logs to the DEV channel with severity ERROR, if logging has been enabled for the source file where the call is performed at the provided verbosity level, via the vmodule setting.
ErrorfDepth logs to the DEV channel with severity ERROR, offsetting the caller's stack frame by 'depth'.
Event looks for a tracing span in the context and logs the given message to it.
Eventf looks for a tracing span in the context and formats and logs the given message to it.
Every is a convenience constructor for an EveryN object that allows a log message every n duration.
ExpensiveLogEnabled is used to test whether effort should be used to produce log messages whose construction has a measurable cost.
ExpensiveLogEnabledVDepth is like ExpensiveLogEnabled, and additionally accepts a depth parameter for determining the caller's verbosity.
Fatal logs to the DEV channel with severity FATAL.
FatalChan is closed when Fatal is called.
Fatalf logs to the DEV channel with severity FATAL, if logging has been enabled for the source file where the call is performed at the provided verbosity level, via the vmodule setting.
FatalfDepth logs to the DEV channel with severity FATAL, offsetting the caller's stack frame by 'depth'.
FetchEntriesFromFiles fetches all available log entries on disk that are between the 'startTimestamp' and 'endTimestamp'.
FetchEntriesFromFilesWithFormat is like FetchEntriesFromFiles but the caller can specify the format of the log file.
FlushAllSync explicitly flushes all asynchronous buffered logging sinks, including pending log file I/O and buffered network sinks.
FlushFiles explicitly flushes all pending log file I/O.
FormatLegacyEntry writes the contents of the legacy log entry struct to the specified writer.
FormatLegacyEntryPrefix writes a color-decorated prefix to the specified writer.
FormatLegacyEntryWithOptionalColors is like FormatLegacyEntry but the caller can specify a color profile.
FormatWithContextTags formats the string and prepends the context tags.
GetFormatterDocs returns the embedded documentation for all the supported formats.
GetLogReader returns a reader for the specified filename.
GetVModule returns the current vmodule configuration.
HasSpan returns true if the context has a span that should be logged to.
Info logs to the DEV channel with severity INFO.
Infof logs to the DEV channel with severity INFO, if logging has been enabled for the source file where the call is performed at the provided verbosity level, via the vmodule setting.
InfofDepth logs to the DEV channel with severity INFO, offsetting the caller's stack frame by 'depth'.
InterceptWith diverts log traffic to the given interceptor `fn`.
IsActive returns true iff the main logger already has some events logged, or some secondary logger was created with configuration taken from the main logger.
ListLogFiles returns a slice of logpb.FileInfo structs for each log file on the local node, in any of the configured log directories.
LoggingToStderr returns true if log messages of the given severity sent to the DEV channel are also visible on the process' external stderr.
MakeFileInfo constructs a FileInfo from FileDetails and os.FileInfo.
MakeLegacyEntry creates an logpb.Entry.
MakeProcessUnavailable invokes the emergency stop function set through SetMakeProcessUnavailableFunc, if any.
MakeServerAmbientContext creates an AmbientContext for use by server processes.
MakeTestingAmbientContext creates an AmbientContext for use in tests, when a test does not have sufficient details to instantiate a fully fledged server AmbientContext.
MakeTestingAmbientCtxWithNewTracer is like MakeTestingAmbientContext() but it also instantiates a new tracer.
NewEntryDecoder creates a new instance of EntryDecoder.
NewEntryDecoderWithFormat is like NewEntryDecoder but the caller can specify the format of the log file.
NewStdLogger creates a *stdLog.Logger that forwards messages to the CockroachDB logs with the specified severity.
ParseLogFilename parses a filename into FileDetails if it matches the pattern for log files.
ReadFormatFromLogFile attempts to read the format from the header data of in.
RefreshHttpSinkHeaders will iterate over all http sinks and replace the sink's dynamicHeaders with newly generated dynamicHeaders.
ResetExitFunc undoes any prior call to SetExitFunc.
SafeManaged marks the provided argument as safe from a redaction perspective in cases where the node is being run as part of a managed service.
SafeOperational is a transparent wrapper around `redact.Safe` that acts as documentation for *why* the object is being marked as safe.
Scope creates a TestLogScope which corresponds to the lifetime of a temporary logging directory.
ScopeWithoutShowLogs creates a TestLogScope which corresponds to the lifetime of a temporary logging directory.
SelectEditMode returns an EditSensitiveData value that's suitable for use with NewDecoder depending on client-side desired "redact" and "keep redactable" flags.
SetExitFunc allows setting a function that will be called to exit the process when a Fatal message is generated.
SetLogMetrics injects an initialized implementation of the LogMetrics interface into the logging package.
SetMakeProcessUnavailableFunc sets a function that will be called when MakeProcessUnavailable is called.
SetReportOrPanicFn injects a definition for reportOrPanic into pkg/util/log.
SetVModule alters the vmodule logging level to the passed in value.
Shout logs to channel DEV, and also to the real stderr if logging is currently redirected to a file.
Shoutf logs to channel DEV, and also to the real stderr if logging is currently redirected to a file.
ShowLogs returns whether -show-logs was passed (used for testing).
StartAlwaysFlush configures all loggers to start flushing writes.
Structured emits a structured JSON payload to the DEV channel, along with the included metadata.
StructuredEvent emits a structured event log of severity sev to the channel the provided event belongs to.
StructuredEventDepth emits a structured event log of severity sev and depth to the channel the provided event belongs to.
TemporarilyDisableFileGCForMainLogger disables the file-based GC until the cleanup fn is called.
TestingResetActive clears the active bit.
TestingSetRedactable sets the redactable flag on the file output of the debug logger for usage in a test.
V returns true if the logging verbosity is set to the specified level or higher.
VDepth reports whether verbosity at the call site is at least the requested level.
VErrEvent either logs an error message to the DEV channel (which also outputs to the active trace) or to the trace alone, depending on whether the specified verbosity level is active.
VErrEventf either logs an error message to the DEV Channel (which also outputs to the active trace) or to the trace alone, depending on whether the specified verbosity level is active.
VErrEventfDepth performs the same as VErrEventf but checks the verbosity level at the given depth in the call stack.
VErrorf logs to the DEV channel with severity ERROR.
VEvent either logs a message to the DEV channel (which also outputs to the active trace) or to the trace alone, depending on whether the specified verbosity level is active.
VEventf either logs a message to the DEV channel (which also outputs to the active trace) or to the trace alone, depending on whether the specified verbosity level is active.
VEventfDepth performs the same as VEventf but checks the verbosity level at the given depth in the call stack.
VFatalf logs to the DEV channel with severity FATAL.
VInfof logs to the DEV channel with severity INFO.
VWarningf logs to the DEV channel with severity WARNING.
Warning logs to the DEV channel with severity WARNING.
Warningf logs to the DEV channel with severity WARNING, if logging has been enabled for the source file where the call is performed at the provided verbosity level, via the vmodule setting.
WarningfDepth logs to the DEV channel with severity WARNING, offsetting the caller's stack frame by 'depth'.

# Constants

FileNamePattern matches log files to avoid exposing non-log files accidentally and it splits the details of the filename into groups for easy parsing.
FilePattern matches log file paths.
FileTimeFormat is RFC3339 with the colons replaced with underscores.
KeepRedactable can be used as an argument to SelectEditMode to indicate that the logs should retain their sensitive data markers so that they can be redacted later.
MessageTimeFormat is the format of the timestamp in log message headers of crdb formatted logs.
MessageTimeFormatWithTZ is like MessageTimeFormat but with a numeric time zone included.
WithFlattenedSensitiveData is the log including sensitive data, but markers stripped.
WithMarkedSensitiveData is the "raw" log with sensitive data markers included.
WithoutSensitiveData is the log with the sensitive data redacted, but markers included.
WithoutSensitiveDataNorMarkers is the log with the sensitive data redacted, and markers stripped.

# Variables

Dev is a logger that logs to the DEV channel.
ExitTimeoutOnFatalLog is the time the process will wait for logs to write before exiting.
FormatParsers maps the user facing format names to the internal representation.
Health is a logger that logs to the HEALTH channel.
KvDistribution is a logger that logs to the KV_DISTRIBUTION channel.
MaybeSendCrashReport is injected by package logcrash.
Ops is a logger that logs to the OPS channel.
OrigStderr points to the original stderr stream when the process started.
Privileges is a logger that logs to the PRIVILEGES channel.
SensitiveAccess is a logger that logs to the SENSITIVE_ACCESS channel.
Sessions is a logger that logs to the SESSIONS channel.
SqlExec is a logger that logs to the SQL_EXEC channel.
SqlInternalPerf is a logger that logs to the SQL_INTERNAL_PERF channel.
SqlPerf is a logger that logs to the SQL_PERF channel.
SqlSchema is a logger that logs to the SQL_SCHEMA channel.
Registered structured event types below.
Storage is a logger that logs to the STORAGE channel.
Telemetry is a logger that logs to the TELEMETRY channel.
UserAdmin is a logger that logs to the USER_ADMIN channel.

# Structs

AmbientContext is a helper type used to "annotate" context.Contexts with log tags and a Tracer.
EveryN provides a way to rate limit spammy log messages.
HTTPLogError represents an HTTP error status code from a logging request.
JSONCompactEntry represents a JSON log entry in the compact format.
JSONEntry represents a JSON log entry.
StructuredLogMeta is a metadata object that accompanies each event emitted via Structured.
StructuredPayload is a wrapper around StructuredMeta and an arbitrary event.
TestLogMetricsImpl is a dummy implementation of the LogMetrics interface, used for tests.
TestLogScope represents the lifetime of a logging output.

# Interfaces

ChannelLogger is a helper interface to ease the run-time selection of channels.
EntryDecoder is used to decode log entries.
Interceptor is the type of an object that can be passed to InterceptWith().
LogMetrics enables the registration and recording of metrics within the log package.
StructuredLogProcessor defines the interface used to process structured logs, logged via Structured, categorized by their EventType.

# Type aliases

Channel aliases a type.
EditSensitiveData describes how the messages in log entries should be edited through the API.
EventType identifies the specific type of structured log event.
Level specifies a level of verbosity for V logs.
Metric is the enum representation of each metric supported within the log package.
Severity aliases a type.
TestingLogSink is exported for mock generation.