Package 

Interface InternalLogger


  • 
    public interface InternalLogger
    
                        

    A Logger used to log messages from the internal implementation of the Datadog SDKs.

    Rule of thumb to decide which level and target we're using for the Internal Logger usage:

    • Target.USER: the message needs to either be actionable or provide information about the main steps in data processing (tracking, storage, upload).

    • Target.TELEMETRY: any event that need to be tracked for usage monitoring or for error diagnostic.

    • Target.MAINTAINER: can be anything relevant about the moving parts of the core SDK or any of the feature. Level is left to the discretion of the authors of a log.

    • Method Detail

      • log

         abstract Unit log(InternalLogger.Level level, InternalLogger.Target target, Function0<String> messageBuilder, Throwable throwable, Boolean onlyOnce, Map<String, Object> additionalProperties)

        Logs a message from the internal implementation.

        Parameters:
        level - the severity level of the log
        target - the target handler for the log
        messageBuilder - the lambda building the log message
        throwable - an optional throwable error
        onlyOnce - whether only one instance of the message should be sent per lifetime of the logger (default is false)
        additionalProperties - additional properties to add to the log
      • log

         abstract Unit log(InternalLogger.Level level, List<InternalLogger.Target> targets, Function0<String> messageBuilder, Throwable throwable, Boolean onlyOnce, Map<String, Object> additionalProperties)

        Logs a message from the internal implementation.

        Parameters:
        level - the severity level of the log
        targets - list of the target handlers for the log
        messageBuilder - the lambda building the log message
        throwable - an optional throwable error
        onlyOnce - whether only one instance of the message should be sent per lifetime of the logger (default is false, onlyOnce applies to each target independently)
        additionalProperties - additional properties to add to the log
      • logMetric

         abstract Unit logMetric(Function0<String> messageBuilder, Map<String, Object> additionalProperties, @FloatRange(from = 0.0.toDouble(), to = 100.0.toDouble()) Float samplingRate, @FloatRange(from = 0.0.toDouble(), to = 100.0.toDouble()) Float creationSampleRate)

        Logs a specific metric from the internal implementation. The metric values will be sent as key-value pairs in the additionalProperties and as part of the com.datadog.android.telemetry.model.TelemetryDebugEvent.Telemetry event.

        Parameters:
        messageBuilder - the lambda building the metric message
        additionalProperties - additional properties to add to the metric
        samplingRate - value between 0-100 for sampling the event.
        creationSampleRate - value between 0-100.
      • startPerformanceMeasure

         abstract PerformanceMetric startPerformanceMeasure(String callerClass, TelemetryMetricType metric, @FloatRange(from = 0.0.toDouble(), to = 100.0.toDouble()) Float samplingRate, String operationName)

        Start measuring a performance metric.

        Parameters:
        callerClass - name of the class calling the performance measurement.
        metric - name of the metric that we want to measure.
        samplingRate - value between 0-100 for sampling the event.
        operationName - the name of the operation being measured
      • logApiUsage

         abstract Unit logApiUsage(@FloatRange(from = 0.0.toDouble(), to = 100.0.toDouble()) Float samplingRate, Function0<InternalTelemetryEvent.ApiUsage> apiUsageEventBuilder)

        Logs an API usage from the internal implementation.

        Parameters:
        samplingRate - value between 0-100 for sampling the event.
        apiUsageEventBuilder - the lambda building the API event being tracked