1 /***************************************************************************
2 * Copyright (C) 2005-2018 by the Quassel Project *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) version 3. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
23 #include "common-export.h"
25 #include <QStringList>
26 #include <QTextStream>
32 * Class encapsulating a single log message.
34 * Very similar in concept to qDebug() and friends.
36 class COMMON_EXPORT LogMessage
39 LogMessage(Logger::LogLevel level);
43 LogMessage& operator<<(const T& value)
45 _stream << value << " ";
49 LogMessage& operator<<(const QStringList& t);
50 LogMessage& operator<<(bool t);
55 Logger::LogLevel _logLevel;
58 // The only reason for LogMessage and the helpers below to exist is the fact that Qt versions
59 // prior to 5.5 did not support the Info level.
60 // Once we can rely on Qt 5.5, they will be removed and replaced by the native Qt functions.
63 * Creates an info-level log message.
67 class quInfo : public LogMessage
71 : LogMessage(Logger::LogLevel::Info)
76 * Creates a warning-level log message.
80 class quWarning : public LogMessage
84 : LogMessage(Logger::LogLevel::Warning)
89 * Creates an error-level log message.
93 class quError : public LogMessage
97 : LogMessage(Logger::LogLevel::Error)