Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide logging member variables, use references for stream op. #1369

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
#include "src/core/logging.h"


QDebug operator<< (QDebug debug, const DebugIndent& indent)
QDebug& operator<< (QDebug& debug, const DebugIndent& indent)
{
for (int i = 1; i<indent.level; i++) {
for (int i = 1; i<indent.level_; i++) {
debug << '.';
}
return debug;
Expand Down
10 changes: 6 additions & 4 deletions src/core/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,20 @@ class FatalMsg : public QDebug
class DebugIndent
{
public:
explicit DebugIndent(int l) : level(l) {}
explicit DebugIndent(int level) : level_(level) {}
friend QDebug& operator<<(QDebug& debug, const DebugIndent& indent);

int level;
private:
int level_;
};

QDebug operator<< (QDebug debug, const DebugIndent& indent);
QDebug& operator<< (QDebug& debug, const DebugIndent& indent);

class Debug : public QDebug
{
public:
Debug() : QDebug(QtDebugMsg) {nospace().noquote();}
explicit Debug(int l) : QDebug(QtDebugMsg) {nospace().noquote() << DebugIndent(l);}
explicit Debug(int level) : QDebug(QtDebugMsg) {nospace().noquote() << DebugIndent(level);}
};

#endif // SRC_CORE_LOGGING_H_