Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Unified Diff: ui/events/ozone/evdev/libgestures_glue/gesture_logging.cc

Issue 193813003: ozone: evdev: Add libgestures bindings for touchpad & mouse support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moved 1 space by 1 character Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/events/ozone/evdev/libgestures_glue/gesture_logging.cc
diff --git a/ui/events/ozone/evdev/libgestures_glue/gesture_logging.cc b/ui/events/ozone/evdev/libgestures_glue/gesture_logging.cc
new file mode 100644
index 0000000000000000000000000000000000000000..009fc9390203800720b7daa8834ab6879187d232
--- /dev/null
+++ b/ui/events/ozone/evdev/libgestures_glue/gesture_logging.cc
@@ -0,0 +1,32 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/events/ozone/evdev/libgestures_glue/gesture_logging.h"
+
+#include <gestures/gestures.h>
+#include <stdarg.h>
+
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
+
+namespace {
+
+std::string FormatLog(const char* fmt, va_list args) {
+ std::string msg = base::StringPrintV(fmt, args);
+ if (!msg.empty() && msg[msg.size() - 1] == '\n')
+ msg.erase(msg.end() - 1, msg.end());
+ return msg;
+}
+
+} // namespace
+
+void gestures_log(int verb, const char* fmt, ...) {
+ va_list args;
+ va_start(args, fmt);
+ if (verb <= GESTURES_LOG_ERROR)
+ LOG(ERROR) << "gestures: " << FormatLog(fmt, args);
+ else if (verb <= GESTURES_LOG_INFO)
+ VLOG(3) << "gestures: " << FormatLog(fmt, args);
+ va_end(args);
+}

Powered by Google App Engine
This is Rietveld 408576698