Skip to content

RUMM-2042: Filter Datadog logs per level#920

Merged
0xnm merged 2 commits into
developfrom
nogorodnikov/rumm-2042/filter-logs-per-level
May 2, 2022
Merged

RUMM-2042: Filter Datadog logs per level#920
0xnm merged 2 commits into
developfrom
nogorodnikov/rumm-2042/filter-logs-per-level

Conversation

@0xnm

@0xnm 0xnm commented Apr 29, 2022

Copy link
Copy Markdown
Member

What does this PR do?

Closes #847. This PR includes the following:

  • Adds a possibility to set up default logger with min priority log level set in the DatadogTree (Timber integration module).
  • Adds a possibility to define minimum log level sent to the Datadog servers in the Logger.Builder configuration (main SDK module). Note: logcat logs are not affected by this parameter.

Motivation

This feature is useful when Datadog logger is used in the collaboration with other loggers and there is need for more granular control for Datadog logger to avoid sending unwanted log levels to avoid exploding log volume usage (can be the case of verbose or debug logs).

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@0xnm
0xnm requested a review from a team as a code owner April 29, 2022 13:46
@xgouchet xgouchet added the size-small This PR is small sized label Apr 29, 2022
@codecov-commenter

codecov-commenter commented Apr 29, 2022

Copy link
Copy Markdown

Codecov Report

Merging #920 (2ff8024) into develop (b86ff41) will decrease coverage by 0.21%.
The diff coverage is 66.67%.

@@             Coverage Diff             @@
##           develop     #920      +/-   ##
===========================================
- Coverage    83.02%   82.81%   -0.21%     
===========================================
  Files          267      263       -4     
  Lines         9057     8977      -80     
  Branches      1456     1449       -7     
===========================================
- Hits          7519     7434      -85     
- Misses        1139     1147       +8     
+ Partials       399      396       -3     
Impacted Files Coverage Δ
...n/kotlin/com/datadog/android/timber/DatadogTree.kt 55.56% <0.00%> (-44.44%) ⬇️
...og/android/rum/internal/net/RumOkHttpUploaderV2.kt 100.00% <ø> (ø)
.../android/core/internal/net/DataOkHttpUploaderV2.kt 98.77% <100.00%> (ø)
.../src/main/kotlin/com/datadog/android/log/Logger.kt 96.00% <100.00%> (+0.13%) ⬆️
...g/android/log/internal/logger/DatadogLogHandler.kt 95.65% <100.00%> (+0.41%) ⬆️
...ndroid/core/internal/persistence/file/EventMeta.kt 70.00% <0.00%> (-20.00%) ⬇️
...rc/main/java/com/datadog/opentracing/DDTracer.java 55.65% <0.00%> (-0.42%) ⬇️
...android/rum/internal/ndk/DatadogNdkCrashHandler.kt 87.36% <0.00%> (+0.57%) ⬆️
.../android/rum/internal/monitor/DatadogRumMonitor.kt 95.09% <0.00%> (+0.61%) ⬆️
...android/log/internal/logger/TelemetryLogHandler.kt 100.00% <0.00%> (+25.00%) ⬆️

class DatadogTree(
private val logger: Logger
private val logger: Logger,
private val minLogPriority: Int = -1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this one really necessary? After all people can set the min priority when building the logger passed in parameter.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated my PR, replaced it by a secondary constructor which will create a default logger with min priority set.

Comment thread dd-sdk-android/src/main/kotlin/com/datadog/android/log/Logger.kt
@0xnm
0xnm force-pushed the nogorodnikov/rumm-2042/filter-logs-per-level branch from 4f8048d to 2ff8024 Compare May 2, 2022 09:09
@0xnm
0xnm merged commit 9677ec1 into develop May 2, 2022
@0xnm
0xnm deleted the nogorodnikov/rumm-2042/filter-logs-per-level branch May 2, 2022 12:09
@0xnm 0xnm mentioned this pull request May 3, 2022
3 tasks
@xgouchet xgouchet added this to the 1.14.0 milestone Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-small This PR is small sized

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add possibility to set minimal log level for DatadogTree

4 participants