From bd3bed841cce2c462b36febbbdbccd243f21854e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 29 Mar 2017 13:10:35 +0200 Subject: Print notification type names --- common/notification.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'common') diff --git a/common/notification.cpp b/common/notification.cpp index 806d04a..e688b6d 100644 --- a/common/notification.cpp +++ b/common/notification.cpp @@ -19,8 +19,37 @@ */ #include "notification.h" +using namespace Sink; + +static QByteArray name(int type) +{ + switch (type) { + case Notification::Shutdown: + return "shutdown"; + case Notification::Status: + return "status"; + case Notification::Info: + return "info"; + case Notification::Warning: + return "warning"; + case Notification::Error: + return "error"; + case Notification::Progress: + return "progress"; + case Notification::Inspection: + return "inspection"; + case Notification::RevisionUpdate: + return "revisionupdate"; + case Notification::FlushCompletion: + return "flushcompletion"; + } + return "Unknown:" + QByteArray::number(type); +} + QDebug operator<<(QDebug dbg, const Sink::Notification &n) { - dbg << "Notification(Type: " << n.type << "Id, : " << n.id << ", Code: " << n.code << ", Message: " << n.message << ", Entities: " << n.entities << ")"; + dbg << "Notification(Type: " << name(n.type) << "Id, : " << n.id << ", Code: "; + dbg << n.code; + dbg << ", Message: " << n.message << ", Entities: " << n.entities << ")"; return dbg.space(); } -- cgit v1.2.3