-
public final class Logger.BuilderA Builder class for a Logger.
-
-
Constructor Summary
Constructors Constructor Description Logger.Builder()
-
Method Summary
Modifier and Type Method Description final Loggerbuild()Builds a Logger based on the current state of this Builder. final Logger.BuildersetServiceName(String serviceName)Sets the service name that will appear in your logs. final Logger.BuildersetDatadogLogsEnabled(Boolean enabled)Enables your logs to be sent to the Datadog servers. final Logger.BuildersetDatadogLogsMinPriority(Integer minLogPriority)Sets a minimum priority for the log to be sent to the Datadog servers. final Logger.BuildersetLogcatLogsEnabled(Boolean enabled)Enables your logs to be duplicated in LogCat. final Logger.BuildersetNetworkInfoEnabled(Boolean enabled)Enables network information to be automatically added in your logs. final Logger.BuildersetLoggerName(String name)Sets the logger name that will appear in your logs when a throwable is attached. final Logger.BuildersetBundleWithTraceEnabled(Boolean enabled)Enables the logs bundling with the current active trace. final Logger.BuildersetBundleWithRumEnabled(Boolean enabled)Enables the logs bundling with the current active View. final Logger.BuildersetSampleRate(@FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble()) Float rate)Sets the sample rate for this Logger. -
-
Method Detail
-
setServiceName
final Logger.Builder setServiceName(String serviceName)
Sets the service name that will appear in your logs.
- Parameters:
serviceName- the service name (default = application package name)
-
setDatadogLogsEnabled
final Logger.Builder setDatadogLogsEnabled(Boolean enabled)
Enables your logs to be sent to the Datadog servers. You can use this feature to disable Datadog logs based on a configuration or an application flavor.
- Parameters:
enabled- true by default
-
setDatadogLogsMinPriority
final Logger.Builder setDatadogLogsMinPriority(Integer minLogPriority)
Sets a minimum 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:
minLogPriority- Minimum log priority to be sent to the Datadog servers.
-
setLogcatLogsEnabled
final Logger.Builder setLogcatLogsEnabled(Boolean enabled)
Enables your logs to be duplicated in LogCat.
- Parameters:
enabled- false by default
-
setNetworkInfoEnabled
final Logger.Builder setNetworkInfoEnabled(Boolean enabled)
Enables network information to be automatically added in your logs.
- Parameters:
enabled- false by default
-
setLoggerName
final Logger.Builder setLoggerName(String name)
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)
-
setBundleWithTraceEnabled
final Logger.Builder setBundleWithTraceEnabled(Boolean enabled)
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
-
setBundleWithRumEnabled
final Logger.Builder setBundleWithRumEnabled(Boolean enabled)
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
-
setSampleRate
final Logger.Builder setSampleRate(@FloatRange(from = 0.0.toDouble(), to = 1.0.toDouble()) Float rate)
Sets the sample rate for this Logger.
- Parameters:
rate- the sampling rate, in percent.
-
-
-
-