Couchbase .NET SDK __CB_SDK_VERSION__

Show / Hide Table of Contents

Interface IRedactor

Wraps a log argument in redaction tags according to the configured RedactionLevel.

Namespace: Couchbase.Core.Logging
Assembly: Couchbase.NetClient.dll
Syntax
public interface IRedactor
Remarks

This is redaction as seen from outside the SDK. Obtain the cluster's redactor with cluster.ClusterServices.GetRequiredService<IRedactor>() to redact your own log arguments the way the SDK does, so that one tool can strip both.

The SDK does not redact through this interface. It uses an internal type whose equivalent methods are generic, so that log arguments are not boxed and redaction can be inlined; this interface exists for callers outside the assembly, which cannot name that type. A call through it therefore boxes the result and, for value-type arguments, the argument before any log level is consulted. Consequently, registering an implementation of IRedactor as a cluster service does not change how the SDK redacts — the registration is discarded and a warning is logged. Use RedactionLevel to control redaction.

Methods

View Source

MetaData(object?)

Redact metadata, such as bucket, scope and collection names.

Declaration
object? MetaData(object? message)
Parameters
Type Name Description
object message

The value to redact, or null.

Returns
Type Description
object

A value that applies the redaction when it is converted to a string, or null if message was null. Not redacted at Partial.

View Source

SystemData(object?)

Redact system data, such as hostnames and ports.

Declaration
object? SystemData(object? message)
Parameters
Type Name Description
object message

The value to redact, or null.

Returns
Type Description
object

A value that applies the redaction when it is converted to a string, or null if message was null. Not redacted at Partial.

View Source

UserData(object?)

Redact user data, such as document keys, usernames and query statements.

Declaration
object? UserData(object? message)
Parameters
Type Name Description
object message

The value to redact, or null.

Returns
Type Description
object

A value that applies the redaction when it is converted to a string, or null if message was null. The redacted string is not built until then.

  • View Source
In this article
Back to top Copyright © 2020 Couchbase, Inc. All rights reserved.