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

Side by Side Diff: mojo/public/cpp/environment/lib/logging.cc

Issue 1447273002: Mojo Log service and a thread-safe client library. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix destructor race condition in log_client.cc; add some comments Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/public/cpp/environment/logging.h" 5 #include "mojo/public/cpp/environment/logging.h"
6 6
7 #include "mojo/public/cpp/environment/environment.h" 7 #include "mojo/public/cpp/environment/environment.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 namespace internal { 10 namespace internal {
(...skipping 14 matching lines...) Expand all
25 rv = s + 1; 25 rv = s + 1;
26 s++; 26 s++;
27 } 27 }
28 return rv; 28 return rv;
29 } 29 }
30 30
31 } // namespace 31 } // namespace
32 32
33 // TODO(vtl): Maybe we should preserve the full path and strip it out at a 33 // TODO(vtl): Maybe we should preserve the full path and strip it out at a
34 // different level instead? 34 // different level instead?
35 // TODO(vardhan): Should we make a timestamp part of the LogMessage? Since we
36 // emit log messages only when we go out of scope, we won't know exactly when
37 // log messages are issued.
35 LogMessage::LogMessage(MojoLogLevel log_level, const char* file, int line) 38 LogMessage::LogMessage(MojoLogLevel log_level, const char* file, int line)
36 : log_level_(log_level), file_(GetFilename(file)), line_(line) { 39 : log_level_(log_level), file_(GetFilename(file)), line_(line) {
37 } 40 }
38 41
39 LogMessage::~LogMessage() { 42 LogMessage::~LogMessage() {
40 Environment::GetDefaultLogger()->LogMessage( 43 Environment::GetDefaultLogger()->LogMessage(
41 log_level_, file_, static_cast<uint32_t>(line_), stream_.str().c_str()); 44 log_level_, file_, static_cast<uint32_t>(line_), stream_.str().c_str());
42 } 45 }
43 46
44 } // namespace internal 47 } // namespace internal
45 } // namespace mojo 48 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698