Move RTCFileLogger to webrtc/base/objc.
BUG= R=jiayl@webrtc.org, tkchin@webrtc.org Review URL: https://codereview.webrtc.org/1692243003 . Patch from Jon Hjelle <hjon@andyet.net>. Cr-Commit-Position: refs/heads/master@{#11754}
This commit is contained in:
parent
65c8fd78c6
commit
6140fcc11c
@ -43,7 +43,6 @@
|
||||
'objc/RTCDataChannel.mm',
|
||||
'objc/RTCEnumConverter.h',
|
||||
'objc/RTCEnumConverter.mm',
|
||||
'objc/RTCFileLogger.mm',
|
||||
'objc/RTCI420Frame+Internal.h',
|
||||
'objc/RTCI420Frame.mm',
|
||||
'objc/RTCICECandidate+Internal.h',
|
||||
|
||||
@ -635,6 +635,8 @@ if (is_ios) {
|
||||
"objc/RTCCameraPreviewView.m",
|
||||
"objc/RTCDispatcher.h",
|
||||
"objc/RTCDispatcher.m",
|
||||
"objc/RTCFileLogger.h",
|
||||
"objc/RTCFileLogger.mm",
|
||||
"objc/RTCLogging.h",
|
||||
"objc/RTCLogging.mm",
|
||||
"objc/RTCMacros.h",
|
||||
|
||||
@ -36,6 +36,8 @@
|
||||
'objc/NSString+StdString.mm',
|
||||
'objc/RTCDispatcher.h',
|
||||
'objc/RTCDispatcher.m',
|
||||
'objc/RTCFileLogger.h',
|
||||
'objc/RTCFileLogger.mm',
|
||||
'objc/RTCLogging.h',
|
||||
'objc/RTCLogging.mm',
|
||||
'objc/RTCMacros.h',
|
||||
|
||||
69
webrtc/base/objc/RTCFileLogger.h
Normal file
69
webrtc/base/objc/RTCFileLogger.h
Normal file
@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RTCFileLoggerSeverity) {
|
||||
kRTCFileLoggerSeverityVerbose,
|
||||
kRTCFileLoggerSeverityInfo,
|
||||
kRTCFileLoggerSeverityWarning,
|
||||
kRTCFileLoggerSeverityError
|
||||
};
|
||||
|
||||
typedef NS_ENUM(NSUInteger, RTCFileLoggerRotationType) {
|
||||
kRTCFileLoggerTypeCall,
|
||||
kRTCFileLoggerTypeApp,
|
||||
};
|
||||
|
||||
// This class intercepts WebRTC logs and saves them to a file. The file size
|
||||
// will not exceed the given maximum bytesize. When the maximum bytesize is
|
||||
// reached, logs are rotated according to the rotationType specified.
|
||||
// For kRTCFileLoggerTypeCall, logs from the beginning and the end
|
||||
// are preserved while the middle section is overwritten instead.
|
||||
// For kRTCFileLoggerTypeApp, the oldest log is overwritten.
|
||||
// This class is not threadsafe.
|
||||
@interface RTCFileLogger : NSObject
|
||||
|
||||
// The severity level to capture. The default is kRTCFileLoggerSeverityInfo.
|
||||
@property(nonatomic, assign) RTCFileLoggerSeverity severity;
|
||||
|
||||
// The rotation type for this file logger. The default is
|
||||
// kRTCFileLoggerTypeCall.
|
||||
@property(nonatomic, readonly) RTCFileLoggerRotationType rotationType;
|
||||
|
||||
// Disables buffering disk writes. Should be set before |start|. Buffering
|
||||
// is enabled by default for performance.
|
||||
@property(nonatomic, assign) BOOL shouldDisableBuffering;
|
||||
|
||||
// Default constructor provides default settings for dir path, file size and
|
||||
// rotation type.
|
||||
- (instancetype)init;
|
||||
|
||||
// Create file logger with default rotation type.
|
||||
- (instancetype)initWithDirPath:(NSString *)dirPath
|
||||
maxFileSize:(NSUInteger)maxFileSize;
|
||||
|
||||
- (instancetype)initWithDirPath:(NSString *)dirPath
|
||||
maxFileSize:(NSUInteger)maxFileSize
|
||||
rotationType:(RTCFileLoggerRotationType)rotationType
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
|
||||
// Starts writing WebRTC logs to disk if not already started. Overwrites any
|
||||
// existing file(s).
|
||||
- (void)start;
|
||||
|
||||
// Stops writing WebRTC logs to disk. This method is also called on dealloc.
|
||||
- (void)stop;
|
||||
|
||||
// Returns the current contents of the logs, or nil if start has been called
|
||||
// without a stop.
|
||||
- (NSData *)logData;
|
||||
|
||||
@end
|
||||
@ -1,28 +1,11 @@
|
||||
/*
|
||||
* libjingle
|
||||
* Copyright 2015 Google Inc.
|
||||
* Copyright 2015 The WebRTC project authors. All Rights Reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* Use of this source code is governed by a BSD-style license
|
||||
* that can be found in the LICENSE file in the root of the source
|
||||
* tree. An additional intellectual property rights grant can be found
|
||||
* in the file PATENTS. All contributing project authors may
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#import "RTCFileLogger.h"
|
||||
@ -199,6 +199,7 @@
|
||||
'type': 'static_library',
|
||||
'dependencies': [
|
||||
'apprtc_common',
|
||||
'base/base.gyp:rtc_base_objc',
|
||||
'../talk/app/webrtc/legacy_objc_api.gyp:libjingle_peerconnection_objc',
|
||||
'socketrocket',
|
||||
],
|
||||
@ -247,6 +248,7 @@
|
||||
],
|
||||
},
|
||||
'export_dependent_settings': [
|
||||
'base/base.gyp:rtc_base_objc',
|
||||
'../talk/app/webrtc/legacy_objc_api.gyp:libjingle_peerconnection_objc',
|
||||
],
|
||||
'conditions': [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user