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

Side by Side Diff: src/log-utils.cc

Issue 12093008: log: add %p option to --logfile, expands to pid (Closed)
Patch Set: Created 7 years, 11 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 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 AddIsolateIdIfNeeded(&stream); 100 AddIsolateIdIfNeeded(&stream);
101 for (const char* p = FLAG_logfile; *p; p++) { 101 for (const char* p = FLAG_logfile; *p; p++) {
102 if (*p == '%') { 102 if (*p == '%') {
103 p++; 103 p++;
104 switch (*p) { 104 switch (*p) {
105 case '\0': 105 case '\0':
106 // If there's a % at the end of the string we back up 106 // If there's a % at the end of the string we back up
107 // one character so we can escape the loop properly. 107 // one character so we can escape the loop properly.
108 p--; 108 p--;
109 break; 109 break;
110 case 'p':
111 stream.Add("%d", OS::GetCurrentProcessId());
112 break;
110 case 't': { 113 case 't': {
111 // %t expands to the current time in milliseconds. 114 // %t expands to the current time in milliseconds.
112 double time = OS::TimeCurrentMillis(); 115 double time = OS::TimeCurrentMillis();
113 stream.Add("%.0f", FmtElm(time)); 116 stream.Add("%.0f", FmtElm(time));
114 break; 117 break;
115 } 118 }
116 case '%': 119 case '%':
117 // %% expands (contracts really) to %. 120 // %% expands (contracts really) to %.
118 stream.Put('%'); 121 stream.Put('%');
119 break; 122 break;
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 ASSERT(pos_ <= Log::kMessageBufferSize); 306 ASSERT(pos_ <= Log::kMessageBufferSize);
304 const int written = log_->WriteToFile(log_->message_buffer_, pos_); 307 const int written = log_->WriteToFile(log_->message_buffer_, pos_);
305 if (written != pos_) { 308 if (written != pos_) {
306 log_->stop(); 309 log_->stop();
307 log_->logger_->LogFailure(); 310 log_->logger_->LogFailure();
308 } 311 }
309 } 312 }
310 313
311 314
312 } } // namespace v8::internal 315 } } // namespace v8::internal
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