summaryrefslogtreecommitdiffstats
path: root/tools/check-messages.py
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2024-08-19 15:53:45 +0200
committerAndrei Pavel <andrei@isc.org>2024-08-22 14:47:24 +0200
commit571cd571bc8925f4ff12e13e48024f9d396b5653 (patch)
tree06b79d845c10eca79319392a686f1b44f4316b2f /tools/check-messages.py
parent[#1945] add missing messages and premium messages to the ARM (diff)
downloadkea-571cd571bc8925f4ff12e13e48024f9d396b5653.tar.xz
kea-571cd571bc8925f4ff12e13e48024f9d396b5653.zip
[#1945] add ARM section for debug messages indexed by log level
Diffstat (limited to '')
-rwxr-xr-xtools/check-messages.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/check-messages.py b/tools/check-messages.py
index 7170c30e90..63d7149e40 100755
--- a/tools/check-messages.py
+++ b/tools/check-messages.py
@@ -146,6 +146,24 @@ def check_placeholder_ids(messages):
return failure
+def generate_page_with_messages_printed_on_each_debug_level(messages, debug_levels):
+ content = []
+ for log_level in sorted(set(debug_levels.values())):
+ subtitle = f'Messages printed on debuglevel {log_level}'
+ content.append(subtitle)
+ content.append('=' * len(subtitle))
+ content.append('\n')
+ for message_id, message in sorted(messages.items()):
+ if message['debug_log_level_line'] == f'Logged at debug log level {log_level}.':
+ content.append(f'- {message_id}')
+ content.append('\n')
+ parent_dir = os.path.dirname(os.path.realpath(os.path.abspath(sys.argv[0])))
+ with open(f'{parent_dir}/../doc/sphinx/debug-messages.rst', 'w', encoding='utf-8') as f:
+ for i in content:
+ f.write(i)
+ f.write('\n')
+
+
def remove_message_definition(message, file):
new_lines = []
removing = False
@@ -330,6 +348,9 @@ def main():
# 7. Checks that the placeholder ids are consecutive, starting with 1, and unique in the same message definition.
failure |= check_placeholder_ids(messages)
+ if args.autofix:
+ generate_page_with_messages_printed_on_each_debug_level(messages, debug_levels)
+
if failure:
sys.exit(1)