Add option to log a warning for unregistered field trials
Until now you only had the option to RTC_DCHECK for unregistered field
trials. This makes it possible to log a warning instead.
Bug: webrtc:14154
Change-Id: I8628054e3c9b5d690f241a93e61299126b732ed0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/295300
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Emil Lundmark <lndmrk@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39417}
diff --git a/system_wrappers/source/field_trial.cc b/system_wrappers/source/field_trial.cc
index 8f15b4e..a1d21fa 100644
--- a/system_wrappers/source/field_trial.cc
+++ b/system_wrappers/source/field_trial.cc
@@ -116,10 +116,15 @@
#ifndef WEBRTC_EXCLUDE_FIELD_TRIAL_DEFAULT
std::string FindFullName(absl::string_view name) {
-#if WEBRTC_STRICT_FIELD_TRIALS
+#if WEBRTC_STRICT_FIELD_TRIALS == 1
RTC_DCHECK(absl::c_linear_search(kRegisteredFieldTrials, name) ||
TestKeys().contains(name))
- << name << " is not registered.";
+ << name << " is not registered, see g3doc/field-trials.md.";
+#elif WEBRTC_STRICT_FIELD_TRIALS == 2
+ RTC_LOG_IF(LS_WARNING,
+ !(absl::c_linear_search(kRegisteredFieldTrials, name) ||
+ TestKeys().contains(name)))
+ << name << " is not registered, see g3doc/field-trials.md.";
#endif
if (trials_init_string == NULL)