Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: talk/app/webrtc/objc/public/RTCFileLogger.h

Issue 1432753003: Add oldest rotation type option to RTCFileLogger (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Updated per feedback Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « talk/app/webrtc/objc/RTCFileLogger.mm ('k') | webrtc/base/filerotatingstream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 21 matching lines...) Expand all
32 #define NS_DESIGNATED_INITIALIZER 32 #define NS_DESIGNATED_INITIALIZER
33 #endif 33 #endif
34 34
35 typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) { 35 typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) {
36 kRTCFileLoggerSeverityVerbose, 36 kRTCFileLoggerSeverityVerbose,
37 kRTCFileLoggerSeverityInfo, 37 kRTCFileLoggerSeverityInfo,
38 kRTCFileLoggerSeverityWarning, 38 kRTCFileLoggerSeverityWarning,
39 kRTCFileLoggerSeverityError 39 kRTCFileLoggerSeverityError
40 }; 40 };
41 41
42 typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) {
43 kRTCFileLoggerTypeCall,
44 kRTCFileLoggerTypeApp,
45 };
46
42 // This class intercepts WebRTC logs and saves them to a file. The file size 47 // This class intercepts WebRTC logs and saves them to a file. The file size
43 // will not exceed the given maximum bytesize. When the maximum bytesize is 48 // will not exceed the given maximum bytesize. When the maximum bytesize is
44 // reached logs from the beginning and the end are preserved while the middle 49 // reached, logs are rotated according to the rotationType specified.
45 // section is overwritten instead. 50 // For kRTCFileLoggerTypeCall, logs from the beginning and the end
51 // are preserved while the middle section is overwritten instead.
52 // For kRTCFileLoggerTypeApp, the oldest log is overwritten.
46 // This class is not threadsafe. 53 // This class is not threadsafe.
47 @interface RTCFileLogger : NSObject 54 @interface RTCFileLogger : NSObject
48 55
49 // The severity level to capture. The default is kRTCFileLoggerSeverityInfo. 56 // The severity level to capture. The default is kRTCFileLoggerSeverityInfo.
50 @property(nonatomic, assign) RTCFileLoggerSeverity severity; 57 @property(nonatomic, assign) RTCFileLoggerSeverity severity;
51 58
52 // Default constructor provides default settings for dir path and file size. 59 // The rotation type for this file logger. The default is
60 // kRTCFileLoggerTypeCall.
61 @property(nonatomic, readonly) RTCFileLoggerRotationType rotationType;
62
63 // Default constructor provides default settings for dir path, file size and
64 // rotation type.
53 - (instancetype)init; 65 - (instancetype)init;
54 66
67 // Create file logger with default rotation type.
68 - (instancetype)initWithDirPath:(NSString *)dirPath
69 maxFileSize:(NSUInteger)maxFileSize;
70
55 - (instancetype)initWithDirPath:(NSString *)dirPath 71 - (instancetype)initWithDirPath:(NSString *)dirPath
56 maxFileSize:(NSUInteger)maxFileSize 72 maxFileSize:(NSUInteger)maxFileSize
73 rotationType:(RTCFileLoggerRotationType)rotationType
57 NS_DESIGNATED_INITIALIZER; 74 NS_DESIGNATED_INITIALIZER;
58 75
59 // Starts writing WebRTC logs to disk if not already started. Overwrites any 76 // Starts writing WebRTC logs to disk if not already started. Overwrites any
60 // existing file(s). 77 // existing file(s).
61 - (void)start; 78 - (void)start;
62 79
63 // Stops writing WebRTC logs to disk. This method is also called on dealloc. 80 // Stops writing WebRTC logs to disk. This method is also called on dealloc.
64 - (void)stop; 81 - (void)stop;
65 82
66 // Returns the current contents of the logs, or nil if start has been called 83 // Returns the current contents of the logs, or nil if start has been called
67 // without a stop. 84 // without a stop.
68 - (NSData *)logData; 85 - (NSData *)logData;
69 86
70 @end 87 @end
OLDNEW
« no previous file with comments | « talk/app/webrtc/objc/RTCFileLogger.mm ('k') | webrtc/base/filerotatingstream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698