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

Side by Side Diff: mojo/environment/default_logger_impl.cc

Issue 330933004: Mojo: Add basic logging facilities to environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/environment/default_logger_impl.h"
6
7 #include "base/logging.h"
8 #include "base/macros.h"
9
10 namespace mojo {
11 namespace internal {
12 namespace {
13
14 int GetChromiumLogLevel(MojoLogLevel log_level) {
15 // Our log levels correspond, except for "fatal":
16 COMPILE_ASSERT(logging::LOG_VERBOSE == MOJO_LOG_LEVEL_VERBOSE,
17 verbose_log_level_value_mismatch);
18 COMPILE_ASSERT(logging::LOG_INFO == MOJO_LOG_LEVEL_INFO,
19 info_log_level_value_mismatch);
20 COMPILE_ASSERT(logging::LOG_WARNING == MOJO_LOG_LEVEL_WARNING,
21 warning_log_level_value_mismatch);
22 COMPILE_ASSERT(logging::LOG_ERROR == MOJO_LOG_LEVEL_ERROR,
23 error_log_level_value_mismatch);
24
25 return (log_level >= MOJO_LOG_LEVEL_FATAL) ? logging::LOG_FATAL : log_level;
26 }
27
28 void LogMessage(MojoLogLevel log_level, const char* message) {
29 // TODO(vtl): Possibly, we should try to pull out the file and line number
30 // from |message|.
31 logging::LogMessage(__FILE__, __LINE__,
darin (slow to review) 2014/06/14 06:08:23 it seems like MojoLogger::LogMessage should probab
32 GetChromiumLogLevel(log_level)).stream() << message;
33 }
34
35 const MojoLogger kDefaultLogger = {
36 LogMessage
37 };
38
39 } // namespace
40
41 const MojoLogger* GetDefaultLoggerImpl() {
42 return &kDefaultLogger;
43 }
44
45 } // namespace internal
46 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698