dlr-gtlab / gtlab-core

GTlab Core Framework
https://www.gtlab.de
Other
7 stars 2 forks source link

[CHANGE] - Decide, when to log vs when to use cout / cerr in console app #1185

Open rainman110 opened 4 months ago

rainman110 commented 4 months ago

Summary

We currently use gtError etc, when reporting any messages. This also applies to the console app.

IMHO, user argument errors of the console app should not be reported as a log message, but printed via cerr (as a matter of style). Or at least without the date and id (to be discussed)!

Impact on the codebase

Batch application

Current workarounds

No response

mariusalexander commented 4 months ago

We could solve this using the logging system:

Most destinations have a dedicated formatter object that denotes how a message is logged. For us this is usually LEVEL [TIME] [ID] MESSAGE (this behavior is implemented by gt::log::Formatter::Default).

However, there is also a formatter, that only logs the message for gtInfo (no time, no level etc.). Warnings, Errors etc are not affected and will be logged as usual. The formatter is called gt::log::Formatter::MessageOnly.

We could use the MessageOnly formatter for the console and switch to the Default formatter once we execute the desired function (or we could not switch at all and only use the MessageOnly formatter for the console)

jensschmeink commented 4 months ago

Idea: establish a guildeline for console communication (@jensschmeink @rainman110 make a meeting to generate first version of guildeline)