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

Side by Side Diff: webrtc/system_wrappers/source/trace_impl.cc

Issue 1256773002: When we trace to file, add eol of each trace message. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 5 months 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 | « no previous file | no next file » | 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 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (row_count_text_ == 0) { 395 if (row_count_text_ == 0) {
396 char message[WEBRTC_TRACE_MAX_MESSAGE_SIZE + 1]; 396 char message[WEBRTC_TRACE_MAX_MESSAGE_SIZE + 1];
397 int32_t length = AddDateTimeInfo(message); 397 int32_t length = AddDateTimeInfo(message);
398 if (length != -1) { 398 if (length != -1) {
399 message[length] = 0; 399 message[length] = 0;
400 message[length - 1] = '\n'; 400 message[length - 1] = '\n';
401 trace_file_->Write(message, length); 401 trace_file_->Write(message, length);
402 row_count_text_++; 402 row_count_text_++;
403 } 403 }
404 } 404 }
405 trace_file_->Write(msg, length); 405 trace_file_->Write(msg, length);
pbos-webrtc 2015/07/24 09:47:34 Isn't here where you want to add the '\n'? You sho
braveyao1 2015/07/24 10:02:39 It used to be here. But now since the input parame
406 row_count_text_++; 406 row_count_text_++;
407 } 407 }
408 408
409 void TraceImpl::AddImpl(const TraceLevel level, 409 void TraceImpl::AddImpl(const TraceLevel level,
410 const TraceModule module, 410 const TraceModule module,
411 const int32_t id, 411 const int32_t id,
412 const char msg[WEBRTC_TRACE_MAX_MESSAGE_SIZE]) { 412 const char msg[WEBRTC_TRACE_MAX_MESSAGE_SIZE]) {
413 if (!TraceCheck(level)) 413 if (!TraceCheck(level))
414 return; 414 return;
415 415
(...skipping 25 matching lines...) Expand all
441 return; 441 return;
442 442
443 message_ptr += len; 443 message_ptr += len;
444 ack_len += len; 444 ack_len += len;
445 445
446 len = AddMessage(message_ptr, msg, static_cast<uint16_t>(ack_len)); 446 len = AddMessage(message_ptr, msg, static_cast<uint16_t>(ack_len));
447 if (len == -1) 447 if (len == -1)
448 return; 448 return;
449 449
450 ack_len += len; 450 ack_len += len;
451 trace_message[ack_len] = 0;
452 trace_message[ack_len - 1] = '\n';
pbos-webrtc 2015/07/24 08:29:11 Doesn't this truncate the last character?
braveyao1 2015/07/24 10:02:39 I was afraid so. But magically it doesn't. It's eq
451 AddMessageToList(trace_message, static_cast<uint16_t>(ack_len), level); 453 AddMessageToList(trace_message, static_cast<uint16_t>(ack_len), level);
452 } 454 }
453 455
454 bool TraceImpl::TraceCheck(const TraceLevel level) const { 456 bool TraceImpl::TraceCheck(const TraceLevel level) const {
455 return (level & level_filter()) ? true : false; 457 return (level & level_filter()) ? true : false;
456 } 458 }
457 459
458 bool TraceImpl::UpdateFileName( 460 bool TraceImpl::UpdateFileName(
459 const char file_name_utf8[FileWrapper::kMaxFileNameSize], 461 const char file_name_utf8[FileWrapper::kMaxFileNameSize],
460 char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize], 462 char file_name_with_counter_utf8[FileWrapper::kMaxFileNameSize],
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 va_end(args); 592 va_end(args);
591 buff = temp_buff; 593 buff = temp_buff;
592 } 594 }
593 trace->AddImpl(level, module, id, buff); 595 trace->AddImpl(level, module, id, buff);
594 } 596 }
595 ReturnTrace(); 597 ReturnTrace();
596 } 598 }
597 } 599 }
598 600
599 } // namespace webrtc 601 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698