diff options
author | Andrei Pavel <andrei@isc.org> | 2024-08-22 11:49:03 +0200 |
---|---|---|
committer | Andrei Pavel <andrei@isc.org> | 2024-08-22 14:48:11 +0200 |
commit | 317af481f8530fcba709c0c874524506923955d5 (patch) | |
tree | 1aacc34c7255985f5094755643935df9b1abf3dc /tools | |
parent | [#1945] add ChangeLog entry (diff) | |
download | kea-317af481f8530fcba709c0c874524506923955d5.tar.xz kea-317af481f8530fcba709c0c874524506923955d5.zip |
[#1945] address review
- generate kea-messages.rst automatically on make -C doc/sphinx
- add disclaimer header that debug-messages.rst and kea-messages.rst are
generated
- minor changes to debug level variable names
- do not write section "Messages printed" in tools/check-messages.py if
there are no messages
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/check-messages.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/check-messages.py b/tools/check-messages.py index 63d7149e40..aaa1773c5b 100755 --- a/tools/check-messages.py +++ b/tools/check-messages.py @@ -149,16 +149,22 @@ def check_placeholder_ids(messages): def generate_page_with_messages_printed_on_each_debug_level(messages, debug_levels): content = [] for log_level in sorted(set(debug_levels.values())): + messages_at_this_log_level = [(message_id, message) for message_id, message in sorted(messages.items()) + if message['debug_log_level_line'] == f'Logged at debug log level {log_level}.'] + if len(messages_at_this_log_level) == 0: + # Do not write "Messages printed" subtitle if there are no messages. + continue 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}') + for message_id, message in messages_at_this_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: + f.write('..\n') + f.write(' File generated by "./tools/check-messages.py -a". Do not edit by hand.\n\n') for i in content: f.write(i) f.write('\n') |