OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 - (void)stop { | 118 - (void)stop { |
119 if (!_hasStarted) { | 119 if (!_hasStarted) { |
120 return; | 120 return; |
121 } | 121 } |
122 RTC_DCHECK(_logSink); | 122 RTC_DCHECK(_logSink); |
123 rtc::LogMessage::RemoveLogToStream(_logSink.get()); | 123 rtc::LogMessage::RemoveLogToStream(_logSink.get()); |
124 _hasStarted = NO; | 124 _hasStarted = NO; |
125 _logSink.reset(); | 125 _logSink.reset(); |
126 } | 126 } |
127 | 127 |
| 128 #if 0 |
128 - (NSData *)logData { | 129 - (NSData *)logData { |
129 if (_hasStarted) { | 130 if (_hasStarted) { |
130 return nil; | 131 return nil; |
131 } | 132 } |
132 NSMutableData* logData = [NSMutableData data]; | 133 NSMutableData* logData = [NSMutableData data]; |
133 std::unique_ptr<rtc::FileRotatingStream> stream; | 134 std::unique_ptr<rtc::FileRotatingStream> stream; |
134 switch(_rotationType) { | 135 switch(_rotationType) { |
135 case RTCFileLoggerTypeApp: | 136 case RTCFileLoggerTypeApp: |
136 stream.reset( | 137 stream.reset( |
137 new rtc::FileRotatingStream(_dirPath.UTF8String, | 138 new rtc::FileRotatingStream(_dirPath.UTF8String, |
(...skipping 12 matching lines...) Expand all Loading... |
150 } | 151 } |
151 size_t read = 0; | 152 size_t read = 0; |
152 // Allocate memory using malloc so we can pass it direcly to NSData without | 153 // Allocate memory using malloc so we can pass it direcly to NSData without |
153 // copying. | 154 // copying. |
154 std::unique_ptr<uint8_t[]> buffer(static_cast<uint8_t*>(malloc(bufferSize))); | 155 std::unique_ptr<uint8_t[]> buffer(static_cast<uint8_t*>(malloc(bufferSize))); |
155 stream->ReadAll(buffer.get(), bufferSize, &read, nullptr); | 156 stream->ReadAll(buffer.get(), bufferSize, &read, nullptr); |
156 logData = [[NSMutableData alloc] initWithBytesNoCopy:buffer.release() | 157 logData = [[NSMutableData alloc] initWithBytesNoCopy:buffer.release() |
157 length:read]; | 158 length:read]; |
158 return logData; | 159 return logData; |
159 } | 160 } |
| 161 #endif |
160 | 162 |
161 #pragma mark - Private | 163 #pragma mark - Private |
162 | 164 |
163 - (rtc::LoggingSeverity)rtcSeverity { | 165 - (rtc::LoggingSeverity)rtcSeverity { |
164 switch (_severity) { | 166 switch (_severity) { |
165 case RTCFileLoggerSeverityVerbose: | 167 case RTCFileLoggerSeverityVerbose: |
166 return rtc::LS_VERBOSE; | 168 return rtc::LS_VERBOSE; |
167 case RTCFileLoggerSeverityInfo: | 169 case RTCFileLoggerSeverityInfo: |
168 return rtc::LS_INFO; | 170 return rtc::LS_INFO; |
169 case RTCFileLoggerSeverityWarning: | 171 case RTCFileLoggerSeverityWarning: |
170 return rtc::LS_WARNING; | 172 return rtc::LS_WARNING; |
171 case RTCFileLoggerSeverityError: | 173 case RTCFileLoggerSeverityError: |
172 return rtc::LS_ERROR; | 174 return rtc::LS_ERROR; |
173 } | 175 } |
174 } | 176 } |
175 | 177 |
176 @end | 178 @end |
OLD | NEW |