mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 958596 - Allow TreeLog logging to be conditioned on a pref. r=Bas
This commit is contained in:
parent
51adf1e7a4
commit
5bda1577dd
@ -162,10 +162,15 @@ public:
|
||||
: mLog(LogOptions::NoNewline),
|
||||
mPrefix(aPrefix),
|
||||
mDepth(0),
|
||||
mStartOfLine(true) {}
|
||||
mStartOfLine(true),
|
||||
mConditionedOnPref(false),
|
||||
mPref(nullptr) {}
|
||||
|
||||
template <typename T>
|
||||
TreeLog& operator<<(const T& aObject) {
|
||||
if (mConditionedOnPref && !*mPref) {
|
||||
return *this;
|
||||
}
|
||||
if (mStartOfLine) {
|
||||
mLog << '[' << mPrefix << "] " << std::string(mDepth * INDENT_PER_LEVEL, ' ');
|
||||
mStartOfLine = false;
|
||||
@ -182,11 +187,18 @@ public:
|
||||
|
||||
void IncreaseIndent() { ++mDepth; }
|
||||
void DecreaseIndent() { --mDepth; }
|
||||
|
||||
void ConditionOnPref(bool* aPref) {
|
||||
mConditionedOnPref = true;
|
||||
mPref = aPref;
|
||||
}
|
||||
private:
|
||||
Log<LOG_DEBUG> mLog;
|
||||
std::string mPrefix;
|
||||
uint32_t mDepth;
|
||||
bool mStartOfLine;
|
||||
bool mConditionedOnPref;
|
||||
bool* mPref;
|
||||
|
||||
template <typename T>
|
||||
static bool EndsInNewline(const T& aObject) {
|
||||
|
Loading…
Reference in New Issue
Block a user