OLD | NEW |
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/environment/default_logger_impl.h" | 5 #include "mojo/environment/default_logger_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
(...skipping 15 matching lines...) Expand all Loading... |
26 int MojoToChromiumLogLevel(MojoLogLevel log_level) { | 26 int MojoToChromiumLogLevel(MojoLogLevel log_level) { |
27 // See the compile asserts above. | 27 // See the compile asserts above. |
28 return static_cast<int>(log_level); | 28 return static_cast<int>(log_level); |
29 } | 29 } |
30 | 30 |
31 MojoLogLevel ChromiumToMojoLogLevel(int chromium_log_level) { | 31 MojoLogLevel ChromiumToMojoLogLevel(int chromium_log_level) { |
32 // See the compile asserts above. | 32 // See the compile asserts above. |
33 return static_cast<MojoLogLevel>(chromium_log_level); | 33 return static_cast<MojoLogLevel>(chromium_log_level); |
34 } | 34 } |
35 | 35 |
36 void LogMessage(MojoLogLevel log_level, | 36 void LogMessage(MojoLogLevel log_level, const char* message) { |
37 const char* source_file, | |
38 uint32_t source_line, | |
39 const char* message) { | |
40 int chromium_log_level = MojoToChromiumLogLevel(log_level); | 37 int chromium_log_level = MojoToChromiumLogLevel(log_level); |
41 int chromium_min_log_level = logging::GetMinLogLevel(); | 38 int chromium_min_log_level = logging::GetMinLogLevel(); |
42 // "Fatal" errors aren't suppressable. | 39 // "Fatal" errors aren't suppressable. |
43 DCHECK_LE(chromium_min_log_level, logging::LOG_FATAL); | 40 DCHECK_LE(chromium_min_log_level, logging::LOG_FATAL); |
44 if (chromium_log_level < chromium_min_log_level) | 41 if (chromium_log_level < chromium_min_log_level) |
45 return; | 42 return; |
46 | 43 |
47 // TODO(vtl): Possibly, we should try to pull out the file and line number | 44 // TODO(vtl): Possibly, we should try to pull out the file and line number |
48 // from |message|. | 45 // from |message|. |
49 logging::LogMessage(__FILE__, __LINE__, chromium_log_level).stream() | 46 logging::LogMessage(__FILE__, __LINE__, chromium_log_level).stream() |
(...skipping 15 matching lines...) Expand all Loading... |
65 }; | 62 }; |
66 | 63 |
67 } // namespace | 64 } // namespace |
68 | 65 |
69 const MojoLogger* GetDefaultLoggerImpl() { | 66 const MojoLogger* GetDefaultLoggerImpl() { |
70 return &kDefaultLogger; | 67 return &kDefaultLogger; |
71 } | 68 } |
72 | 69 |
73 } // namespace internal | 70 } // namespace internal |
74 } // namespace mojo | 71 } // namespace mojo |
OLD | NEW |