Add ability to filter log messages by type.

This commit is contained in:
sledgehammer999
2016-01-24 21:38:45 +02:00
parent b0c324ace8
commit 73832a5ed8
10 changed files with 194 additions and 46 deletions

View File

@@ -12,11 +12,13 @@ namespace Log
{
enum MsgType
{
NORMAL,
INFO,
WARNING,
CRITICAL //ERROR is defined by libtorrent and results in compiler error
ALL = -1,
NORMAL = 0x1,
INFO = 0x2,
WARNING = 0x4,
CRITICAL = 0x8 //ERROR is defined by libtorrent and results in compiler error
};
Q_DECLARE_FLAGS(MsgTypes, MsgType)
struct Msg
{
@@ -36,6 +38,8 @@ namespace Log
};
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Log::MsgTypes)
class Logger : public QObject
{
Q_OBJECT

View File

@@ -871,6 +871,18 @@ void Preferences::setExecutionLogEnabled(bool b)
setValue("Preferences/ExecutionLog/enabled", b);
}
int Preferences::executionLogMessageTypes() const
{
// as default value we need all the bits set
// -1 is considered the portable way to achieve that
return value("MainWindow/ExecutionLog/Types", -1).toInt();
}
void Preferences::setExecutionLogMessageTypes(const int &value)
{
setValue("MainWindow/ExecutionLog/Types", value);
}
// Queueing system
bool Preferences::isQueueingSystemEnabled() const
{

View File

@@ -276,6 +276,8 @@ public:
// Execution Log
bool isExecutionLogEnabled() const;
void setExecutionLogEnabled(bool b);
int executionLogMessageTypes() const;
void setExecutionLogMessageTypes(const int &value);
// Queueing system
bool isQueueingSystemEnabled() const;