swift
Loading...
Searching...
No Matches
logmessage.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
4#ifndef SWIFT_MISC_LOGMESSAGE_H
5#define SWIFT_MISC_LOGMESSAGE_H
6
8
9#include <QDebug>
10
11#include "misc/statusmessage.h"
14
15namespace swift::misc
16{
26 class SWIFT_MISC_EXPORT CLogMessage : public CMessageBase<CLogMessage>
27 {
28 public:
31
33 CLogMessage() = default;
34
36 CLogMessage(const char *file, int line, const char *function);
37
40
42 operator CStatusMessage();
43
45 static void preformatted(const CStatusMessage &statusMessage);
46
48 static void preformatted(const CStatusMessageList &statusMessages);
49
50 private:
51 QMessageLogger m_logger;
52
53 QByteArray qtCategory() const;
54 QDebug ostream(const QByteArray &category) const;
55 };
56} // namespace swift::misc
57
62#define SWIFT_LOG (swift::misc::CLogMessage { __FILE__, __LINE__, Q_FUNC_INFO })
63
64#endif // SWIFT_MISC_LOGMESSAGE_H
CLogMessage()=default
Construct a message with the "uncategorized" category.
static void preformatted(const CStatusMessage &statusMessage)
Sends a verbatim, preformatted message to the log.
CLogMessage(const char *file, int line, const char *function)
Constructor taking filename, line number, and function name, for uncategorized verbose debug messages...
static void preformatted(const CStatusMessageList &statusMessages)
Sends a list of verbatim, preformatted messages to the log.
~CLogMessage()
Destructor. This actually emits the message.
CMessageBase()=default
Inheriting constructors.
CMessageBase()=default
Default constructor.
Streamable status message, e.g.
Status messages, e.g. from Core -> GUI.
Free functions in swift::misc.
#define SWIFT_MISC_EXPORT
Export a class or function from the library.