OSDN Git Service

Fix dependencies of packages that target earlier releases
[android-x86/packages-apps-Eleven.git] / src / com / cyanogenmod / eleven / ui / activities / preview / util / Logger.java
1 /*
2  *  Copyright (c) 2015. The CyanogenMod Project
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at
7  *
8  *       http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  */
16
17 package com.cyanogenmod.eleven.ui.activities.preview.util;
18
19 import android.text.TextUtils;
20 import android.util.Log;
21
22 /**
23  * <pre>
24  *     Debug logging
25  * </pre>
26  */
27 public class Logger {
28
29     private static final String TAG = "AudioPreview";
30
31     private static boolean isDebugging() {
32         return Log.isLoggable(TAG, Log.DEBUG);
33     }
34
35     /**
36      * Log a debug message
37      *
38      * @param tag {@link String}
39      * @param msg {@link String }
40      *
41      * @throws IllegalArgumentException {@link IllegalArgumentException}
42      */
43     public static void logd(String tag, String msg) throws IllegalArgumentException {
44         if (TextUtils.isEmpty(tag)) {
45             throw new IllegalArgumentException("'tag' cannot be empty!");
46         }
47         if (TextUtils.isEmpty(msg)) {
48             throw new IllegalArgumentException("'msg' cannot be empty!");
49         }
50         if (isDebugging()) {
51             Log.d(TAG, tag + " [ " + msg + " ]");
52         }
53     }
54
55     /**
56      * Log a debug message
57      *
58      * @param tag {@link String}
59      * @param msg {@link String }
60      *
61      * @throws IllegalArgumentException {@link IllegalArgumentException}
62      */
63     public static void loge(String tag, String msg) throws IllegalArgumentException {
64         if (TextUtils.isEmpty(tag)) {
65             throw new IllegalArgumentException("'tag' cannot be empty!");
66         }
67         if (TextUtils.isEmpty(msg)) {
68             throw new IllegalArgumentException("'msg' cannot be empty!");
69         }
70         Log.e(TAG, tag + " [ " + msg + " ]");
71     }
72
73 }