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. 4 5#include "ui/events/ozone/evdev/libgestures_glue/gesture_logging.h" 6 7#include <gestures/gestures.h> 8#include <stdarg.h> 9 10#include "base/logging.h" 11#include "base/strings/stringprintf.h" 12 13namespace { 14 15std::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; 20} 21 22} // namespace 23 24void 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); 32} 33