Skip to content

Commit

Permalink
hide logging member variables, use references for stream op. (#1369)
Browse files Browse the repository at this point in the history
* hide logging member variables, use references for stream op.

* match parameter naming.

* longer names.
  • Loading branch information
tsteven4 authored Nov 6, 2024
1 parent 3a58761 commit dfadba0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
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_

0 comments on commit dfadba0

Please sign in to comment.