diff options
author | Martin Brabham <optedoblivion@cyngn.com> | 2015-05-07 10:53:31 -0700 |
---|---|---|
committer | cretin45 <cretin45@gmail.com> | 2016-01-04 16:24:03 -0800 |
commit | a20b046db71039ee581bb80274cf1fc450b3fd99 (patch) | |
tree | 1d3511baec094e8ea28589d5bd57411d4a11a66d /src/com/android/launcher3/stats/util/Logger.java | |
parent | 2be1306db542d11c4516fb29f2adce08f4c32e7d (diff) | |
download | android_packages_apps_Trebuchet-a20b046db71039ee581bb80274cf1fc450b3fd99.tar.gz android_packages_apps_Trebuchet-a20b046db71039ee581bb80274cf1fc450b3fd99.tar.bz2 android_packages_apps_Trebuchet-a20b046db71039ee581bb80274cf1fc450b3fd99.zip |
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 <roman@cyngn.com>
Stop unnecessary exception posting to logcat.
Change-Id: I4f741246dc2ee77b24c3bb94075e12535fcd7ead
Diffstat (limited to 'src/com/android/launcher3/stats/util/Logger.java')
-rw-r--r-- | src/com/android/launcher3/stats/util/Logger.java | 55 |
1 files changed, 55 insertions, 0 deletions
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; + +/** + * <pre> + * Metrics debug logging + * </pre> + */ +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); + } + +} |