| 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 "ui/events/ozone/evdev/libgestures_glue/gesture_logging.h" | 5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_logging.h" |
| 6 | 6 |
| 7 #include <gestures/gestures.h> | 7 #include <gestures/gestures.h> |
| 8 #include <stdarg.h> | 8 #include <stdarg.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 std::string FormatLog(const char* fmt, va_list args) { | 15 std::string FormatLog(const char* fmt, va_list args) { |
| 16 std::string msg = base::StringPrintV(fmt, args); | 16 std::string msg = base::StringPrintV(fmt, args); |
| 17 if (!msg.empty() && msg[msg.size() - 1] == '\n') | 17 if (!msg.empty() && msg.back() == '\n') |
| 18 msg.erase(msg.end() - 1, msg.end()); | 18 msg.pop_back(); |
| 19 return msg; | 19 return msg; |
| 20 } | 20 } |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 void gestures_log(int verb, const char* fmt, ...) { | 24 void gestures_log(int verb, const char* fmt, ...) { |
| 25 va_list args; | 25 va_list args; |
| 26 va_start(args, fmt); | 26 va_start(args, fmt); |
| 27 if (verb <= GESTURES_LOG_ERROR) | 27 if (verb <= GESTURES_LOG_ERROR) |
| 28 LOG(ERROR) << "gestures: " << FormatLog(fmt, args); | 28 LOG(ERROR) << "gestures: " << FormatLog(fmt, args); |
| 29 else if (verb <= GESTURES_LOG_INFO) | 29 else if (verb <= GESTURES_LOG_INFO) |
| 30 VLOG(3) << "gestures: " << FormatLog(fmt, args); | 30 VLOG(3) << "gestures: " << FormatLog(fmt, args); |
| 31 va_end(args); | 31 va_end(args); |
| 32 } | 32 } |
| OLD | NEW |