1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef LogModulePrefWatcher_h 8 #define LogModulePrefWatcher_h 9 10 #include "nsIObserver.h" 11 12 namespace mozilla { 13 14 /** 15 * Watches for changes to "logging.*" prefs and then updates the appropriate 16 * LogModule's log level. Both the integer and string versions of the LogLevel 17 * enum are supported. 18 * 19 * For example setting the pref "logging.Foo" to "Verbose" will set the 20 * LogModule for "Foo" to the LogLevel::Verbose level. Setting "logging.Bar" to 21 * 4 would set the LogModule for "Bar" to the LogLevel::Debug level. 22 */ 23 class LogModulePrefWatcher : public nsIObserver { 24 public: 25 NS_DECL_ISUPPORTS 26 NS_DECL_NSIOBSERVER 27 28 /** 29 * Starts observing logging pref changes. 30 */ 31 static void RegisterPrefWatcher(); 32 33 private: 34 LogModulePrefWatcher(); 35 virtual ~LogModulePrefWatcher() = default; 36 }; 37 } // namespace mozilla 38 39 #endif // LogModulePrefWatcher_h 40