I'm actually grateful that the original message is so concise, otherwise I wouldn't look for a way to customise it. I don't think it's worth arguing what kind of information should or shouldn't be included there - situations and even tastes differ. On my development machine, I have the following defined:
QT_MESSAGE_PATTERN=%{time h:mm:ss.zzz}|%{category}|%{if- debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endi f}%{if-critical}C%{endif}%{if-fatal}F%{endif}|%{message} See https://doc.qt.io/qt-6/qtlogging.html#qSetMessagePattern for details. Whatever format you apply in this way will be followed by Qt and (unless it overrides, which is unlikely) QGIS as well. Alexey On Sun, 2023-12-10 at 14:03 +0100, Thomas Larsen Wessel wrote: > The documentation (https://doc.qt.io/qt-6/qtlogging.html) states: > > The default pattern is %{if-category}%{category}: > %{endif}%{message} > > 1) In my limited experience most or all logging architectures print > the type (aka. severity or criticality, e.g. warning, debug, info, > etc.) by default. > > 2) And in my personal opinion it should be default to print this, > since the severity is often just as important as the message itself, > when the goal is to leave the user / log reader informed. > > Is there a good reason why the severity is left out of the default > format? > > My current situation and motivation for writing: > > I have a number of Python scripts that rely on PyQGIS, which relies > on Qt. They are part of a small software package that is distributed > to a number of machines. Each of these scripts occasionally produce > log messages via QtLogging, and they are all printed without any > context (unless I set them up differently). Its not my code that > calls QtWarning, etc., they are called from either QGIS or Qt. > > Here is an example. > > QStandardPaths: wrong permissions on runtime directory > /run/user/1000/, 0755 instead of 0700 > > When someone sees this warning, they don't know if this is an error > or warning. They don't know if its severe enough that they should do > something or just ignore this. IMHO there is no doubt it should be > prefixed with "Warning", "WARN" or similar. > > So now I set a custom format in each of my scripts. That works of > course. But IMHO it would make a whole lot of sense if the default > format was changed to include the severity :) > > Sincerely > _______________________________________________ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest