1 /* Copyright (C) 2006 - 2014 Jan Kundrát <jkt@flaska.net> 2 3 This file is part of the Trojita Qt IMAP e-mail client, 4 http://trojita.flaska.net/ 5 6 This program is free software; you can redistribute it and/or 7 modify it under the terms of the GNU General Public License as 8 published by the Free Software Foundation; either version 2 of 9 the License or (at your option) version 3 or any later version 10 accepted by the membership of KDE e.V. (or its successor approved 11 by the membership of KDE e.V.), which shall act as a proxy 12 defined in Section 14 of version 3 of the license. 13 14 This program is distributed in the hope that it will be useful, 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 GNU General Public License for more details. 18 19 You should have received a copy of the GNU General Public License 20 along with this program. If not, see <http://www.gnu.org/licenses/>. 21 */ 22 #ifndef TROJITA_IMAP_LOGGING_H 23 #define TROJITA_IMAP_LOGGING_H 24 25 #include <QDateTime> 26 #include <QVector> 27 28 namespace Common 29 { 30 31 /** @short What is that message related to? */ 32 enum LogKind { 33 LOG_IO_READ, /**< Data read from the server */ 34 LOG_IO_WRITTEN, /**< Data written to the server */ 35 LOG_PARSE_ERROR, /**< Error when parsing data */ 36 LOG_MAILBOX_SYNC, /**< Tracing of mailbox resynchronization */ 37 LOG_TASKS, /**< Tracing related to Tasks */ 38 LOG_MESSAGES, /**< Manipulating messages */ 39 LOG_OTHER /**< Something else */ 40 }; 41 42 /** @short Representaiton of one message */ 43 struct LogMessage { 44 /** @short When did it occur? */ 45 QDateTime timestamp; 46 /** @short What's it related to */ 47 LogKind kind; 48 /** @short Detailed identification of the origin */ 49 QString source; 50 /** @short Actual message */ 51 QString message; 52 /** @short Was it truncated? */ 53 uint truncatedBytes; 54 LogMessageLogMessage55 LogMessage(const QDateTime ×tamp_, const LogKind kind_, const QString &source_, const QString &message_, const uint truncated_): 56 timestamp(timestamp_), kind(kind_), source(source_), message(message_), truncatedBytes(truncated_) 57 { 58 } 59 60 // default constructor for QVector LogMessageLogMessage61 LogMessage() {} 62 }; 63 64 } 65 66 // Both QString and QDateTime are movable, so our combination is movable as well 67 Q_DECLARE_TYPEINFO(Common::LogMessage, Q_MOVABLE_TYPE); 68 69 #endif // TROJITA_IMAP_LOGGING_H 70