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 { |
11 namespace internal { | 11 namespace internal { |
12 namespace { | 12 namespace { |
13 | 13 |
14 // We rely on log levels being the same numerically: | 14 // We rely on log levels being the same numerically: |
15 COMPILE_ASSERT(logging::LOG_VERBOSE == MOJO_LOG_LEVEL_VERBOSE, | 15 static_assert(logging::LOG_VERBOSE == MOJO_LOG_LEVEL_VERBOSE, |
16 verbose_log_level_value_mismatch); | 16 "verbose log level value mismatch"); |
17 COMPILE_ASSERT(logging::LOG_INFO == MOJO_LOG_LEVEL_INFO, | 17 static_assert(logging::LOG_INFO == MOJO_LOG_LEVEL_INFO, |
18 info_log_level_value_mismatch); | 18 "info log level value mismatch"); |
19 COMPILE_ASSERT(logging::LOG_WARNING == MOJO_LOG_LEVEL_WARNING, | 19 static_assert(logging::LOG_WARNING == MOJO_LOG_LEVEL_WARNING, |
20 warning_log_level_value_mismatch); | 20 "warning log level value mismatch"); |
21 COMPILE_ASSERT(logging::LOG_ERROR == MOJO_LOG_LEVEL_ERROR, | 21 static_assert(logging::LOG_ERROR == MOJO_LOG_LEVEL_ERROR, |
22 error_log_level_value_mismatch); | 22 "error log level value mismatch"); |
23 COMPILE_ASSERT(logging::LOG_FATAL == MOJO_LOG_LEVEL_FATAL, | 23 static_assert(logging::LOG_FATAL == MOJO_LOG_LEVEL_FATAL, |
24 fatal_log_level_value_mismatch); | 24 "fatal log level value mismatch"); |
25 | 25 |
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 } |
(...skipping 30 matching lines...) Expand all Loading... |
65 }; | 65 }; |
66 | 66 |
67 } // namespace | 67 } // namespace |
68 | 68 |
69 const MojoLogger* GetDefaultLoggerImpl() { | 69 const MojoLogger* GetDefaultLoggerImpl() { |
70 return &kDefaultLogger; | 70 return &kDefaultLogger; |
71 } | 71 } |
72 | 72 |
73 } // namespace internal | 73 } // namespace internal |
74 } // namespace mojo | 74 } // namespace mojo |
OLD | NEW |