If you think the Android project Android-SDK listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
/*
* Copyright (C) 2014. BaasBox//fromwww.java2s.com
*
* 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.baasbox.android.impl;
import android.util.Log;
import java.util.Locale;
/**
* Created by Andrea Tortorella on 18/01/14.
*/publicfinalclass Logger {
// ------------------------------ FIELDS ------------------------------
privatestaticfinalboolean ENABLED = true;
privatestaticfinal String TAG = "BAASBOX";
// --------------------------- CONSTRUCTORS ---------------------------
private Logger(){
}
// -------------------------- STATIC METHODS --------------------------
publicstaticvoid warn(String format, Object... args) {
if (ENABLED && Log.isLoggable(TAG, Log.WARN)) {
Log.w(TAG, String.format(Locale.US, format, args));
}
}
publicstaticvoid trace(String format, Object... args) {
if (ENABLED && Log.isLoggable(TAG, Log.VERBOSE)) {
Log.v(TAG, String.format(Locale.US, format, args));
}
}
publicstaticvoid info(String format, Object... args) {
if (ENABLED && Log.isLoggable(TAG, Log.INFO)) {
Log.i(TAG, String.format(Locale.US, format, args));
}
}
publicstaticvoid info(Throwable e,String format, Object... args) {
if (ENABLED && Log.isLoggable(TAG, Log.INFO)) {
Log.i(TAG, String.format(Locale.US, format, args),e);
}
}
publicstaticvoid error(String format, Object... args) {
if (ENABLED && Log.isLoggable(TAG, Log.ERROR)) {
Log.e(TAG, String.format(Locale.US, format, args));
}
}
publicstaticvoid error(Throwable t, String format, Object... args) {
if (ENABLED && Log.isLoggable(TAG, Log.ERROR)) {
Log.e(TAG, String.format(Locale.US, format, args), t);
}
}
publicstaticvoid debug(String format, Object... args) {
if (ENABLED && Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, String.format(Locale.US, format, args));
}
}
}