Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / ui / events / ozone / evdev / libgestures_glue / gesture_logging.cc
blob009fc9390203800720b7daa8834ab6879187d232
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
3 // found in the LICENSE file.
5 #include "ui/events/ozone/evdev/libgestures_glue/gesture_logging.h"
7 #include <gestures/gestures.h>
8 #include <stdarg.h>
10 #include "base/logging.h"
11 #include "base/strings/stringprintf.h"
13 namespace {
15 std::string FormatLog(const char* fmt, va_list args) {
16 std::string msg = base::StringPrintV(fmt, args);
17 if (!msg.empty() && msg[msg.size() - 1] == '\n')
18 msg.erase(msg.end() - 1, msg.end());
19 return msg;
22 } // namespace
24 void gestures_log(int verb, const char* fmt, ...) {
25 va_list args;
26 va_start(args, fmt);
27 if (verb <= GESTURES_LOG_ERROR)
28 LOG(ERROR) << "gestures: " << FormatLog(fmt, args);
29 else if (verb <= GESTURES_LOG_INFO)
30 VLOG(3) << "gestures: " << FormatLog(fmt, args);
31 va_end(args);