Repository navigation
Expand file tree
/
Copy pathLCLUserDefaults.h
More file actions
123 lines (95 loc) · 4.2 KB
/
Copy pathLCLUserDefaults.h
File metadata and controls
123 lines (95 loc) · 4.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//
//
// LCLUserDefaults.h
//
//
// Copyright (c) 2009-2011 Arne Harren <ah@0xc0.de>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define _LCLUSERDEFAULTS_VERSION_MAJOR 1
#define _LCLUSERDEFAULTS_VERSION_MINOR 0
#define _LCLUSERDEFAULTS_VERSION_BUILD 3
#define _LCLUSERDEFAULTS_VERSION_SUFFIX ""
//
// LCLUserDefaults
//
// LCLUserDefaults is a LibComponentLogging Core extension which stores/restores
// settings to/from the user defaults.
//
// Currently, LCLUserDefaults can only store/restore active log level settings.
//
// LCLUserDefaults uses the following format for storing log level settings
// in your application's domain:
//
// "logging:<bundle identifier>:<log component name>:level" = <integer>
//
// Examples:
//
// "logging:com.yourcompany.YourApplication:Application/Component 1:level" = 5
// "logging:com.yourcompany.YourApplication:Application/Component 2:level" = 3
//
// You can change the log level settings from the command line by using the
// 'defaults' command, e.g.
//
// defaults write <application> 'logging:com.yourcompany.YourApplication:Application/Component 1:level' -int 2
//
#import <Foundation/Foundation.h>
#import "LCLUserDefaultsConfig.h"
@interface LCLUserDefaults : NSObject {
}
//
// Store/restore to/from standard user defaults.
//
// Stores the active log level settings to the standard user defaults.
+ (void)storeLogLevelSettingsToStandardUserDefaults;
// Stores the active log level settings to the standard user defaults and
// synchronizes the standard user defaults.
+ (void)storeLogLevelSettingsToStandardUserDefaultsAndSynchronize;
// Restores the active log level settings from the standard user defaults.
+ (void)restoreLogLevelSettingsFromStandardUserDefaults;
// Synchronizes the standard user defaults.
+ (void)synchronizeStandardUserDefaults;
//
// Store/restore to/from special user defaults.
//
// Stores the active log level settings to the given user defaults.
+ (void)storeLogLevelSettingsToUserDefaults:(NSUserDefaults *)defaults;
// Stores the active log level settings to the given user defaults and
// synchronizes the user defaults.
+ (void)storeLogLevelSettingsToUserDefaultsAndSynchronize:(NSUserDefaults *)defaults;
// Restores the active log level settings from the given user defaults.
+ (void)restoreLogLevelSettingsFromUserDefaults:(NSUserDefaults *)defaults;
//
// Methods for creatings prefixes and keys.
//
// Returns this class' key prefix which is used for storing log level settings
// in the user defaults. The prefix is based on this class' bundle identifier
// and has the format "logging:<bundle identifier>:". If the bundle identifier
// doesn't exist, the prefix will be "logging:main:".
+ (NSString *)keyPrefix;
// Returns a key for the given component and the given prefix and suffix. The
// returned key has the format "<prefix><component name><suffix>".
+ (NSString *)keyForComponent:(_lcl_component_t)component
prefix:(NSString *)prefix
suffix:(NSString *)suffix;
// Returns a key for the given component and the given prefix and the log level
// suffix.
+ (NSString *)logLevelKeyForComponent:(_lcl_component_t)component
prefix:(NSString *)prefix;
@end