Skip to content

Logger.Builder

Xavier F. Gouchet edited this page Sep 4, 2024 · 1 revision

class Builder@JvmOverloadsconstructor(sdkCore: SdkCore = Datadog.getInstance())

A Builder class for a Logger.

Parameters

sdkCore SDK instance to bind to. If not provided, default instance will be used.

Constructors

Builder

@JvmOverloads

constructor(sdkCore: SdkCore = Datadog.getInstance())

Parameters
sdkCore SDK instance to bind to. If not provided, default instance will be used.

Functions

build

fun build(): Logger

Builds a Logger based on the current state of this Builder.

setBundleWithRumEnabled

fun setBundleWithRumEnabled(enabled: Boolean): Logger.Builder

Enables the logs bundling with the current active View. If this feature is enabled all the logs from this moment on will be bundled with the current view information and you will be able to see all the logs sent during a specific view in the Rum Explorer.

Parameters
enabled true by default

setBundleWithTraceEnabled

fun setBundleWithTraceEnabled(enabled: Boolean): Logger.Builder

Enables the logs bundling with the current active trace. If this feature is enabled all the logs from this moment on will be bundled with the current trace and you will be able to see all the logs sent during a specific trace.

Parameters
enabled true by default

setLogcatLogsEnabled

fun setLogcatLogsEnabled(enabled: Boolean): Logger.Builder

Enables your logs to be duplicated in LogCat.

Parameters
enabled false by default

setName

fun setName(name: String): Logger.Builder

Sets the logger name that will appear in your logs when a throwable is attached.

Parameters
name the logger custom name (default = application package name)

setNetworkInfoEnabled

fun setNetworkInfoEnabled(enabled: Boolean): Logger.Builder

Enables network information to be automatically added in your logs.

Parameters
enabled false by default

setRemoteLogThreshold

fun setRemoteLogThreshold(minLogThreshold: Int): Logger.Builder

Sets a minimum threshold (priority) for the log to be sent to the Datadog servers. If log priority is below this one, then it won't be sent. Default value is -1 (allow all).

Parameters
minLogThreshold Minimum log threshold to be sent to the Datadog servers.

setRemoteSampleRate

fun setRemoteSampleRate(@FloatRange(from = 0.0, to = 100.0)sampleRate: Float): Logger.Builder

Sets the sample rate for this Logger.

Parameters
sampleRate the sample rate, in percent. A value of 30 means we'll send 30% of the logs. If value is 0, no logs will be sent to Datadog. Default is 100.0 (ie: all logs are sent).

setService

fun setService(service: String): Logger.Builder

Sets the service name that will appear in your logs.

Parameters
service the service name (default = application package name)
Clone this wiki locally