OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license | |
5 * that can be found in the LICENSE file in the root of the source | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #import <Foundation/Foundation.h> | |
12 | |
13 #import "webrtc/base/objc/RTCMacros.h" | |
14 | |
15 typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) { | |
16 RTCFileLoggerSeverityVerbose, | |
17 RTCFileLoggerSeverityInfo, | |
18 RTCFileLoggerSeverityWarning, | |
19 RTCFileLoggerSeverityError | |
20 }; | |
21 | |
22 typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) { | |
23 RTCFileLoggerTypeCall, | |
24 RTCFileLoggerTypeApp, | |
25 }; | |
26 | |
27 NS_ASSUME_NONNULL_BEGIN | |
28 | |
29 // This class intercepts WebRTC logs and saves them to a file. The file size | |
30 // will not exceed the given maximum bytesize. When the maximum bytesize is | |
31 // reached, logs are rotated according to the rotationType specified. | |
32 // For kRTCFileLoggerTypeCall, logs from the beginning and the end | |
33 // are preserved while the middle section is overwritten instead. | |
34 // For kRTCFileLoggerTypeApp, the oldest log is overwritten. | |
35 // This class is not threadsafe. | |
36 RTC_EXPORT | |
37 @interface RTCFileLogger : NSObject | |
38 | |
39 // The severity level to capture. The default is kRTCFileLoggerSeverityInfo. | |
40 @property(nonatomic, assign) RTCFileLoggerSeverity severity; | |
41 | |
42 // The rotation type for this file logger. The default is | |
43 // kRTCFileLoggerTypeCall. | |
44 @property(nonatomic, readonly) RTCFileLoggerRotationType rotationType; | |
45 | |
46 // Disables buffering disk writes. Should be set before |start|. Buffering | |
47 // is enabled by default for performance. | |
48 @property(nonatomic, assign) BOOL shouldDisableBuffering; | |
49 | |
50 // Default constructor provides default settings for dir path, file size and | |
51 // rotation type. | |
52 - (instancetype)init; | |
53 | |
54 // Create file logger with default rotation type. | |
55 - (instancetype)initWithDirPath:(NSString *)dirPath | |
56 maxFileSize:(NSUInteger)maxFileSize; | |
57 | |
58 - (instancetype)initWithDirPath:(NSString *)dirPath | |
59 maxFileSize:(NSUInteger)maxFileSize | |
60 rotationType:(RTCFileLoggerRotationType)rotationType | |
61 NS_DESIGNATED_INITIALIZER; | |
62 | |
63 // Starts writing WebRTC logs to disk if not already started. Overwrites any | |
64 // existing file(s). | |
65 - (void)start; | |
66 | |
67 // Stops writing WebRTC logs to disk. This method is also called on dealloc. | |
68 - (void)stop; | |
69 | |
70 // Returns the current contents of the logs, or nil if start has been called | |
71 // without a stop. | |
72 - (NSData *)logData; | |
73 | |
74 @end | |
75 | |
76 NS_ASSUME_NONNULL_END | |
77 | |
OLD | NEW |