| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "remoting/client/plugin/pepper_client_logger.h" | 5 #include "remoting/client/plugin/pepper_client_logger.h" |
| 6 | 6 |
| 7 #include <stdarg.h> // va_list | 7 #include <stdarg.h> // va_list |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "remoting/client/plugin/chromoting_instance.h" | 12 #include "remoting/client/plugin/chromoting_instance.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 | 15 |
| 16 PepperClientLogger::PepperClientLogger(ChromotingInstance* instance) | 16 PepperClientLogger::PepperClientLogger(ChromotingInstance* instance) |
| 17 : instance_(instance), | 17 : instance_(instance), |
| 18 message_loop_(MessageLoop::current()) { | 18 message_loop_(MessageLoop::current()) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 PepperClientLogger::~PepperClientLogger() { | 21 PepperClientLogger::~PepperClientLogger() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 // Copied from base/logging.cc. | |
| 25 const char* const log_severity_names[logging::LOG_NUM_SEVERITIES] = { | |
| 26 "INFO", "WARNING", "ERROR", "ERROR_REPORT", "FATAL" }; | |
| 27 | |
| 28 void PepperClientLogger::va_Log(logging::LogSeverity severity, | 24 void PepperClientLogger::va_Log(logging::LogSeverity severity, |
| 29 const char* format, va_list ap) { | 25 const char* format, va_list ap) { |
| 30 DCHECK(severity >= 0 && severity <= logging::LOG_NUM_SEVERITIES); | 26 DCHECK(severity >= 0 && severity <= logging::LOG_NUM_SEVERITIES); |
| 31 | 27 |
| 32 // Based in LOG_IS_ON macro in base/logging.h. | 28 // Based in LOG_IS_ON macro in base/logging.h. |
| 33 if (severity >= ::logging::GetMinLogLevel()) { | 29 if (severity >= ::logging::GetMinLogLevel()) { |
| 34 std::string message; | 30 std::string message; |
| 35 base::StringAppendV(&message, format, ap); | 31 base::StringAppendV(&message, format, ap); |
| 36 | 32 |
| 37 // Standard logging. | 33 // Standard logging. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 67 message_loop_->PostTask( | 63 message_loop_->PostTask( |
| 68 FROM_HERE, | 64 FROM_HERE, |
| 69 NewRunnableMethod(this, &PepperClientLogger::LogToClientUI, message)); | 65 NewRunnableMethod(this, &PepperClientLogger::LogToClientUI, message)); |
| 70 return; | 66 return; |
| 71 } | 67 } |
| 72 | 68 |
| 73 instance_->GetScriptableObject()->LogDebugInfo(message); | 69 instance_->GetScriptableObject()->LogDebugInfo(message); |
| 74 } | 70 } |
| 75 | 71 |
| 76 } // namespace remoting | 72 } // namespace remoting |
| OLD | NEW |