Bug 8447 - Inconsistent casing in log messages
Summary: Inconsistent casing in log messages
Status: NEW
Alias: None
Product: ThinLinc
Classification: Unclassified
Component: Other (show other bugs)
Version: trunk
Hardware: PC Unknown
: P2 Normal
Target Milestone: LowPrio
Assignee: Bugzilla mail exporter
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-11-12 17:32 CET by Tobias
Modified: 2024-11-21 09:34 CET (History)
1 user (show)

See Also:
Acceptance Criteria:


Attachments

Description Tobias cendio 2024-11-12 17:32:41 CET
In the product overall, there seems to be some inconsistencies in how we
case log messages. The different forms we find are

• "ERROR: This failed" (e.g. tl-setup/tl-setup.py)
• "Error: This failed" (e.g. tlclient/tlclient_session.cc)
• "Error: this failed" (e.g. tlclient/tlclient_util.cc)

Note that the strings above are examples. There might also be instances
of complete lowercase, although none has been found at this point.

Considering that the message after the category (e.g. "Error") is to be
viewed as a new sentence, in combination with our preferred sentence
casing (see bug 5114), it is probably the second style we should settle
for.

Used the following regex to find the different cases:

git grep "['\"].*[A-Z,a-z]+*: [A-Z,a-z].*" ':!*.po'

which can be narrowed down to one of the styles mentioned above by
pruning the sets including lower and uppercase letters in the regex.
Comment 2 Linn cendio 2024-11-21 09:16:36 CET
In cases where our module log to external services, we might want to keep the same formatting as the external code.

One example of this is our printer code which logs to the CUPS log. In this case, CUPS treats the log message differently if it is prefixed with "ERROR" or "Error", and shows the message at different cupsd log level (for info on the different level, see [1] and go to "LogLevel")

[1]: https://www.cups.org/doc/man-cupsd.conf.html

Example message: "<prefix>: Bad input" 

If the prefix is "ERROR", the log line will be in red text, the prefix will be removed from the message and it will show up for cupsd log level "warn".

If instead the prefix is "Error", the log line will be demoted to a debug log line (shown at the lower cupsd log level "debug") and the prefix will be included in the message.

For prefixes "WARNING" and "INFO", all caps or sentence case does not make a difference. 
 * Both variants of "WARNING" gets a yellow log line, prefix removed and shown at cupsd log level "warn"
 * Both variants of "INFO" is shown at cupsd log level "debug"

Since CUPS treats the prefixes in different way, it was decided to keep all caps for our printer modules and revert commit r41327.
Comment 4 Linn cendio 2024-11-21 09:29:58 CET Comment hidden (obsolete)
Comment 5 Linn cendio 2024-11-21 09:34:19 CET
Note that the tests from comment 2 was done on RHEL 9 with CUPS v. 2.3.3.

Note You need to log in before you can comment on or make changes to this bug.