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, const char* message) { | 36 void LogMessage(MojoLogLevel log_level, |
| 37 const char* source_file, |
| 38 uint32_t source_line, |
| 39 const char* message) { |
37 int chromium_log_level = MojoToChromiumLogLevel(log_level); | 40 int chromium_log_level = MojoToChromiumLogLevel(log_level); |
38 int chromium_min_log_level = logging::GetMinLogLevel(); | 41 int chromium_min_log_level = logging::GetMinLogLevel(); |
39 // "Fatal" errors aren't suppressable. | 42 // "Fatal" errors aren't suppressable. |
40 DCHECK_LE(chromium_min_log_level, logging::LOG_FATAL); | 43 DCHECK_LE(chromium_min_log_level, logging::LOG_FATAL); |
41 if (chromium_log_level < chromium_min_log_level) | 44 if (chromium_log_level < chromium_min_log_level) |
42 return; | 45 return; |
43 | 46 |
44 // TODO(vtl): Possibly, we should try to pull out the file and line number | 47 // TODO(vtl): Possibly, we should try to pull out the file and line number |
45 // from |message|. | 48 // from |message|. |
46 logging::LogMessage(__FILE__, __LINE__, chromium_log_level).stream() | 49 logging::LogMessage(__FILE__, __LINE__, chromium_log_level).stream() |
(...skipping 15 matching lines...) Expand all Loading... |
62 }; | 65 }; |
63 | 66 |
64 } // namespace | 67 } // namespace |
65 | 68 |
66 const MojoLogger* GetDefaultLoggerImpl() { | 69 const MojoLogger* GetDefaultLoggerImpl() { |
67 return &kDefaultLogger; | 70 return &kDefaultLogger; |
68 } | 71 } |
69 | 72 |
70 } // namespace internal | 73 } // namespace internal |
71 } // namespace mojo | 74 } // namespace mojo |
OLD | NEW |