From a20b046db71039ee581bb80274cf1fc450b3fd99 Mon Sep 17 00:00:00 2001 From: Martin Brabham Date: Thu, 7 May 2015 10:53:31 -0700 Subject: Trebuchet Statistics: - Add plumbing for sending events. - Add aggregation service that runs on some interval - Hook send events into respective UX interactions Change-Id: I77ba0ab75daf845621d800e0adf3e658096926af Trebuchet: send metrics values as strings - Also refer to the declared intent Change-Id: I3c99cc071aa2f4241ea8d3e6d2e8683f1f748e7d Signed-off-by: Roman Birg Stop unnecessary exception posting to logcat. Change-Id: I4f741246dc2ee77b24c3bb94075e12535fcd7ead --- src/com/android/launcher3/stats/util/Logger.java | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/com/android/launcher3/stats/util/Logger.java (limited to 'src/com/android/launcher3/stats/util') diff --git a/src/com/android/launcher3/stats/util/Logger.java b/src/com/android/launcher3/stats/util/Logger.java new file mode 100644 index 000000000..8d73f54ca --- /dev/null +++ b/src/com/android/launcher3/stats/util/Logger.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2015. The CyanogenMod Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher3.stats.util; + +import android.os.Build; +import android.text.TextUtils; +import android.util.Log; + +/** + *
+ *     Metrics debug logging
+ * 
+ */ +public class Logger { + + private static final String TAG = "TrebuchetStats"; + + /** + * Log a debug message + * + * @param tag {@link String} + * @param msg {@link String } + * @throws IllegalArgumentException {@link IllegalArgumentException} + */ + public static void logd(String tag, String msg) throws IllegalArgumentException { + if (TextUtils.isEmpty(tag)) { + throw new IllegalArgumentException("'tag' cannot be empty!"); + } + if (TextUtils.isEmpty(msg)) { + throw new IllegalArgumentException("'msg' cannot be empty!"); + } + if (isDebugging()) { + Log.d(TAG, tag + " [ " + msg + " ]"); + } + } + + private static boolean isDebugging() { + return Log.isLoggable(TAG, Log.DEBUG); + } + +} -- cgit v1.2.3