]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Flag new user-visible log messages for review
authorPetr Špaček <pspacek@isc.org>
Tue, 15 Mar 2022 10:55:36 +0000 (11:55 +0100)
committerPetr Špaček <pspacek@isc.org>
Fri, 3 Jun 2022 10:12:37 +0000 (12:12 +0200)
Messages with log levels INFO or higher are flagged for manual review.
Purpose of this check is to prevent debug logs to being released with
too-high log level.

(cherry picked from commit b0f59cb5cb924c86f70e6c918a5f09f370563a37)

dangerfile.py

index 797061e2ef80d53c435230a3116d349fb3273f4e..fe13a191dac051d724e116b426a967665404ddf5 100644 (file)
@@ -271,3 +271,24 @@ annotations_added = lines_containing(configure_added_lines, '# [pairwise: ')
 if len(switches_added) > len(annotations_added):
     fail('This merge request adds at least one new `./configure` switch that '
          'is not annotated for pairwise testing purposes.')
+
+###############################################################################
+# USER-VISIBLE LOG LEVELS
+###############################################################################
+#
+# WARN if the merge request adds new user-visible log messages (INFO or above)
+
+user_visible_log_levels = [
+    'ISC_LOG_INFO',
+    'ISC_LOG_NOTICE',
+    'ISC_LOG_WARNING',
+    'ISC_LOG_ERROR',
+    'ISC_LOG_CRITICAL',
+]
+source_added_lines = added_lines(target_branch, ['*.[ch]'])
+for log_level in user_visible_log_levels:
+    if (lines_containing(source_added_lines, log_level)):
+        warn('This merge request adds new user-visible log messages with '
+             'level INFO or above. Please double-check log levels and make '
+             'sure none of the messages added is a leftover debug message.')
+        break