summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-04-09 22:15:28 +0000
committerChris Wilson <chris+github@qwirx.com>2014-04-09 22:15:28 +0000
commit5148795dd1ec5b4372008e96bebf1953baeebab4 (patch)
tree64bc8620efc6dcc9fcb1240068043a7bdeb4edc4
parente0d11ae476981fd56229b4ccffdd30166361548b (diff)
Add a guard that can temporarily add a Logger to the logging system.
This is very useful with the forthcoming Capture logger.
-rw-r--r--lib/common/Logging.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h
index 3e38b6af..a0746c69 100644
--- a/lib/common/Logging.h
+++ b/lib/common/Logging.h
@@ -377,6 +377,23 @@ class Logging
}
}
};
+
+ class TempLoggerGuard
+ {
+ private:
+ Logger* mpLogger;
+
+ public:
+ TempLoggerGuard(Logger* pLogger)
+ : mpLogger(pLogger)
+ {
+ Logging::Add(mpLogger);
+ }
+ ~TempLoggerGuard()
+ {
+ Logging::Remove(mpLogger);
+ }
+ };
};
class FileLogger : public Logger