-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT(client): Introduce new logging system based on spdlog #6707
base: master
Are you sure you want to change the base?
Conversation
For reference, the Windows build failed just for this: D:/a/1/s/src/mumble/Logger.cpp(55): error C2220: the following warning is treated as an error
D:/a/1/s/src/mumble/Logger.cpp(55): warning C4459: declaration of 'masterSink' hides global declaration
D:/a/1/s/src/mumble/Logger.cpp(30): note: see declaration of 'masterSink' |
ddfed70
to
3620795
Compare
Sinks: - OutputDebugString() (for debugger on Windows) - Standard output stream (stdout) - File - Developer console (Qt widget) Improvements compared to our old logging system based on Qt: - Duplicate messages are skipped if less than 5 seconds have passed. When that happens, an informative message is printed. - The previous format/pattern is retained, but the log level (e.g. "<W>") is colored based on the severity. - The log is now written to a file on all platforms, not only Windows and macOS. - When the log file's size reaches 5 MiB, the sink renames it and creates a new one. Up to 4 files are kept: Console.txt -> Console.1.txt Console.1.txt -> Console.2.txt Console.2.txt -> Console.3.txt Console.3.txt -> <delete> - We can eventually create multiple loggers, ideally one for each facility (Audio, ServerHandler, etc.). That would allow us to quickly filter log messages and know right away which subsystem is responsible for them. - Modern C++ string formatting. This of course only applies to the new functions such as log::debug(), not qDebug(). Only one "feature" is not reimplemented: showing a dialog in case of a fatal error, right before exiting the program. However, that only worked on Windows and macOS using their native API, to avoid depending on a Qt event loop.
3620795
to
c7cba41
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the header in a different directory than the implementation file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be used for the server as well.
Sinks:
OutputDebugString()
(for debugger on Windows)Improvements compared to our old logging system based on Qt:
<W>
) is colored based on the severity:That would allow us to quickly filter log messages and know right away which subsystem is responsible for them.
log::debug()
, notqDebug()
.Only one "feature" is not reimplemented: showing a dialog in case of a fatal error, right before exiting the program.
However, that only worked on Windows and macOS using their native API, to avoid depending on a Qt event loop:
mumble/src/mumble/os_win.cpp
Lines 83 to 86 in 5452eef
mumble/src/mumble/os_macx.mm
Lines 52 to 57 in 5452eef