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 <QStringList>
24 #include <QTextStream>
30 * Class encapsulating a single log message.
32 * Very similar in concept to qDebug() and friends.
37 LogMessage(Logger::LogLevel level);
41 LogMessage &operator<<(const T &value) {
42 _stream << value << " ";
46 LogMessage &operator<<(const QStringList &t);
47 LogMessage &operator<<(bool t);
52 Logger::LogLevel _logLevel;
56 // The only reason for LogMessage and the helpers below to exist is the fact that Qt versions
57 // prior to 5.5 did not support the Info level.
58 // Once we can rely on Qt 5.5, they will be removed and replaced by the native Qt functions.
61 * Creates an info-level log message.
65 class quInfo : public LogMessage
68 quInfo() : LogMessage(Logger::LogLevel::Info) {}
73 * Creates a warning-level log message.
77 class quWarning : public LogMessage
80 quWarning() : LogMessage(Logger::LogLevel::Warning) {}
85 * Creates an error-level log message.
89 class quError : public LogMessage
92 quError() : LogMessage(Logger::LogLevel::Error) {}