杨锴
2024-10-09 e987bc09f955e01c2835f01e3a6af20723a579f9
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
// Software License Agreement (BSD License)
//
// Copyright (c) 2010-2016, Deusty, LLC
// All rights reserved.
//
// Redistribution and use of this software in source and binary forms,
// with or without modification, are permitted provided that the following conditions are met:
//
//  *Redistributions of source code must retain the above copyright notice,
//   this list of conditions and the following disclaimer.
//
//  *Neither the name of Deusty nor the names of its contributors may be used
//   to endorse or promote products derived from this software without specific
//   prior written permission of Deusty, LLC.
 
#import <Foundation/Foundation.h>
 
// Disable legacy macros
#ifndef OBSDD_LEGACY_MACROS
    #define OBSDD_LEGACY_MACROS 0
#endif
 
#import "OBSDDLog.h"
 
/**
  *This class provides a log formatter that filters log statements from a logging context not on the whitelist.
 *
  *A log formatter can be added to any logger to format and/or filter its output.
  *You can learn more about log formatters here:
  *Documentation/CustomFormatters.md
 *
  *You can learn more about logging context's here:
  *Documentation/CustomContext.md
 *
  *But here's a quick overview / refresher:
 *
  *Every log statement has a logging context.
  *These come from the underlying logging macros defined in OBSDDLog.h.
  *The default logging context is zero.
  *You can define multiple logging context's for use in your application.
  *For example, logically separate parts of your app each have a different logging context.
  *Also 3rd party frameworks that make use of Lumberjack generally use their own dedicated logging context.
 **/
@interface OBSDDContextWhitelistFilterLogFormatter : NSObject <OBSDDLogFormatter>
 
/**
  * Designated default initializer
 */
- (instancetype)init NS_DESIGNATED_INITIALIZER;
 
/**
  * Add a context to the whitelist
 *
  * @param loggingContext the context
 */
- (void)addToWhitelist:(NSUInteger)loggingContext;
 
/**
  * Remove context from whitelist
 *
  * @param loggingContext the context
 */
- (void)removeFromWhitelist:(NSUInteger)loggingContext;
 
/**
  * Return the whitelist
 */
@property (readonly, copy) NSArray<NSNumber *> *whitelist;
 
/**
  * Check if a context is on the whitelist
 *
  * @param loggingContext the context
 */
- (BOOL)isOnWhitelist:(NSUInteger)loggingContext;
 
@end
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark -
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
/**
  *This class provides a log formatter that filters log statements from a logging context on the blacklist.
 **/
@interface OBSDDContextBlacklistFilterLogFormatter : NSObject <OBSDDLogFormatter>
 
- (instancetype)init NS_DESIGNATED_INITIALIZER;
 
/**
  * Add a context to the blacklist
 *
  * @param loggingContext the context
 */
- (void)addToBlacklist:(NSUInteger)loggingContext;
 
/**
  * Remove context from blacklist
 *
  * @param loggingContext the context
 */
- (void)removeFromBlacklist:(NSUInteger)loggingContext;
 
/**
  * Return the blacklist
 */
@property (readonly, copy) NSArray<NSNumber *> *blacklist;
 
 
/**
  * Check if a context is on the blacklist
 *
  * @param loggingContext the context
 */
- (BOOL)isOnBlacklist:(NSUInteger)loggingContext;
 
@end