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

Issue 20406: First step in refactoring the logging system to allow the logging messages to... (Closed)

Created:
11 years, 10 months ago by Søren Thygesen Gjesse
Modified:
9 years, 7 months ago
CC:
v8-dev
Visibility:
Public.

Description

First step in refactoring the logging system to allow the logging messages to have other destinations than an open file. This change introduces a log message builder which builds the log message in a static string buffer instead of formatting the log message through fprintf. Currently this message can only be written to a file afterwards. Changed the code related events to use the log message builder. Committed: http://code.google.com/p/v8/source/detail?r=1284

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 6

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+128 lines, -46 lines) Patch
M src/log.h View 1 2 4 chunks +12 lines, -3 lines 0 comments Download
M src/log.cc View 1 2 13 chunks +116 lines, -43 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Søren Thygesen Gjesse
I did not change all the logging methods to use this new abstraction as I ...
11 years, 10 months ago (2009-02-16 15:38:49 UTC) #1
Mads Ager (chromium)
LGTM Would it make sense to add assertions to verify in debug mode that we ...
11 years, 10 months ago (2009-02-17 07:48:08 UTC) #2
Søren Thygesen Gjesse
11 years, 10 months ago (2009-02-17 08:20:53 UTC) #3
Added assertion

  ASSERT(pos_ <= Logger::kMessageBufferSize);

to LogMessageBuilder both when building the message and when writing it the
file.

http://codereview.chromium.org/20406/diff/1001/8
File src/log.cc (right):

http://codereview.chromium.org/20406/diff/1001/8#newcode268
Line 268: virtual ~LogMessageBuilder() { }
On 2009/02/17 07:48:08, Mads Ager wrote:
> Are you planning to use this as a base class for different builders?  If not,
> there is no need for a virtual destructor.

Removed virtual. I put it there to follow the new style guide where this would
fail lint.

http://codereview.chromium.org/20406/diff/1001/8#newcode296
Line 296: pos_ += result;
On 2009/02/17 07:48:08, Mads Ager wrote:
> You need to check for a -1 result here.  VSNPrintF guards against buffer
> overflow and returns -1 if the message was truncated.  In that case pos_
should
> not be decremented by one (since that could lead to a negative pos_ value if
> pos_ is zero).

pos_ is now set to kMessageBufferSize if VSNPrintF truncates output and returns
-1.

http://codereview.chromium.org/20406/diff/1001/9
File src/log.h (right):

http://codereview.chromium.org/20406/diff/1001/9#newcode239
Line 239: // mutex_ should be acquired Before using logfile_.
On 2009/02/17 07:48:08, Mads Ager wrote:
> Before -> before.

Done.

Powered by Google App Engine
This is Rietveld 408576698