[Box Backup-commit] COMMIT r3317 - box/trunk/lib/common

subversion at boxbackup.org subversion at boxbackup.org
Wed Apr 9 23:15:28 BST 2014


Author: chris
Date: 2014-04-09 23:15:28 +0100 (Wed, 09 Apr 2014)
New Revision: 3317

Modified:
   box/trunk/lib/common/Logging.h
Log:
Add a guard that can temporarily add a Logger to the logging system.

This is very useful with the forthcoming Capture logger.

Modified: box/trunk/lib/common/Logging.h
===================================================================
--- box/trunk/lib/common/Logging.h	2014-04-09 22:15:25 UTC (rev 3316)
+++ box/trunk/lib/common/Logging.h	2014-04-09 22:15:28 UTC (rev 3317)
@@ -377,6 +377,23 @@
 			}
 		}
 	};
+
+	class TempLoggerGuard
+	{
+		private:
+		Logger* mpLogger;
+
+		public:
+		TempLoggerGuard(Logger* pLogger)
+		: mpLogger(pLogger)
+		{
+			Logging::Add(mpLogger);
+		}
+		~TempLoggerGuard()
+		{
+			Logging::Remove(mpLogger);
+		}
+	};
 };
 
 class FileLogger : public Logger




More information about the Boxbackup-commit mailing list