/*
 * Copyright (C) 2008 The Android Open Source 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-level logging flag
 */

package com.android.deskclock;

import android.os.Build;
import android.util.Log;

public class LogUtils {

    public final static String LOGTAG = "AlarmClock";
    public final static boolean DEBUG = "eng".equals(Build.TYPE) || "userdebug".equals(Build.TYPE);

    public static void v(String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.VERBOSE)) {
            Log.v(LOGTAG, args == null ? message : String.format(message, args));
        }
    }

    public static void v(String tag, String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.VERBOSE)) {
            Log.v(LOGTAG + "/" + tag, args == null ? message : String.format(message, args));
        }
    }

    public static void d(String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.DEBUG)) {
            Log.d(LOGTAG, args == null ? message : String.format(message, args));
        }
    }

    public static void d(String tag, String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.DEBUG)) {
            Log.d(LOGTAG + "/" + tag, args == null ? message : String.format(message, args));
        }
    }

    public static void i(String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.INFO)) {
            Log.i(LOGTAG, args == null ? message : String.format(message, args));
        }
    }

    public static void i(String tag, String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.INFO)) {
            Log.i(LOGTAG + "/" + tag, args == null ? message : String.format(message, args));
        }
    }

    public static void w(String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.WARN)) {
            Log.w(LOGTAG, args == null ? message : String.format(message, args));
        }
    }

    public static void w(String tag, String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.WARN)) {
            Log.w(LOGTAG + "/" + tag, args == null ? message : String.format(message, args));
        }
    }

    public static void e(String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.ERROR)) {
            Log.e(LOGTAG, args == null ? message : String.format(message, args));
        }
    }

    public static void e(String tag, String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.ERROR)) {
            Log.e(LOGTAG + "/" + tag, args == null ? message : String.format(message, args));
        }
    }

    public static void e(String message, Exception e) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.ERROR)) {
            Log.e(LOGTAG, message, e);
        }
    }

    public static void e(String tag, String message, Exception e) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.ERROR)) {
            Log.e(LOGTAG + "/" + tag, message, e);
        }
    }

    public static void wtf(String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.ASSERT)) {
            Log.wtf(LOGTAG, args == null ? message : String.format(message, args));
        }
    }

    public static void wtf(String tag, String message, Object... args) {
        if (DEBUG || Log.isLoggable(LOGTAG, Log.ASSERT)) {
            Log.wtf(LOGTAG + "/" + tag, args == null ? message : String.format(message, args));
        }
    }
}

@@ -1066,32 +1066,72 @@
 G, args == null 
+%7C%7C args.length == 0%0A                    
 ? message : Stri
@@ -1149,32 +1149,32 @@
 essage, args));%0A
-
         %7D%0A    %7D%0A
@@ -1352,33 +1352,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -1608,33 +1608,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -1888,33 +1888,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -2143,33 +2143,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -2422,33 +2422,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -2677,33 +2677,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -2956,33 +2956,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -3212,33 +3212,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -3492,33 +3492,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -4117,33 +4117,73 @@
 rgs == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : String.fo
@@ -4406,25 +4406,65 @@
 == null 
-? message
+%7C%7C args.length == 0 ? message%0A                   
  : Strin

Add check for args.length == 0 in LogUtils.