Process wide logging policy: quiet by default, verbose with -v, everything on stderr.
More...
#include <QByteArray>
#include <QString>
#include <QtGlobal>
#include <atomic>
#include <cstdio>
#include <cstdlib>
#include <iostream>
Go to the source code of this file.
Process wide logging policy: quiet by default, verbose with -v, everything on stderr.
◆ configure()
| void toolx::logging::configure |
( |
bool | verbose | ) |
|
|
inline |
Apply the logging policy, call once at start up before any library is initialised.
Output of the application and of the libraries it uses (Qt, libva, MediaX) is quiet unless verbose is set. Anything that is written is written to stderr, stdout is left unused.
- Parameters
-
| verbose | true to enable informational and debug output |
◆ isVerbose()
| bool toolx::logging::isVerbose |
( |
| ) |
|
|
inline |
Is verbose output enabled (-v / –verbose).
- Returns
- true if verbose output was requested
◆ messageHandler()
| void toolx::logging::messageHandler |
( |
QtMsgType | type, |
|
|
const QMessageLogContext & | , |
|
|
const QString & | message ) |
|
inline |
Qt message handler, writes to stderr only.
Debug, info and warning messages are dropped unless verbose output was requested. Critical and fatal messages (errors) are always written.
- Parameters
-
| type | the severity of the message |
| message | the message text |
◆ verboseFlag()
| std::atomic< bool > & toolx::logging::verboseFlag |
( |
| ) |
|
|
inline |
Storage for the verbose flag.
- Returns
- std::atomic<bool>& the flag
◆ verboseRequested()
| bool toolx::logging::verboseRequested |
( |
int | argc, |
|
|
char * | argv[] ) |
|
inline |
Is –verbose in the command line (-v prints the version instead).
- Parameters
-
| argc | argument count |
| argv | arguments |
- Returns
- true if verbose output was requested