Line data Source code
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 : {
25 : public:
26 : NS_DECL_ISUPPORTS
27 : NS_DECL_NSIOBSERVER
28 :
29 : /**
30 : * Starts observing logging pref changes.
31 : */
32 : static void RegisterPrefWatcher();
33 :
34 : private:
35 : LogModulePrefWatcher();
36 0 : virtual ~LogModulePrefWatcher()
37 0 : {
38 0 : }
39 : };
40 : } // namespace mozilla
41 :
42 : #endif // LogModulePrefWatcher_h
|