logutils java_LogUtils.java

LogUtils.java

// BuildConfig.LOG_DEBUG 为 在build.gradle 中定义的属性,使用方式: buildConfigField "boolean", "LOG_DEBUG", "false"//是否输出LOG信息

/**

* Logger Simple, pretty and powerful logger for android

* 地址:https://github.com/orhanobut/logger

* build.gradle 中需添加: compile 'com.orhanobut:logger:1.15'

* 使用时需 在 Application 中定义相关 设置:

* Logger.init(AppContact.APK_LOG_TAG) // default PRETTYLOGGER or use just init()

.methodCount(2) // default 2

.hideThreadInfo() // default shown

.logLevel(LogLevel.FULL) // default LogLevel.FULL

.methodOffset(2) ; // default 0

*

*/

public class LogUtils {

public static final boolean DEBUG = BuildConfig.LOG_DEBUG;

public LogUtils() {

/* cannot be instantiated */

throw new UnsupportedOperationException("cannot be instantiated");

}

public static final void analytics(String log) {

if (DEBUG)

Logger.d(log);

}

public static final void error(String log) {

if (DEBUG)

Logger.e(log);

}

public static final void log(String log) {

if (DEBUG)

Logger.i(log);

}

public static final void log(String tag, String log) {

if (DEBUG)

Logger.i(tag, log);

}

public static final void logv(String log) {

if (DEBUG)

Logger.v(log);

}

public static final void warn(String log) {

if (DEBUG)

Logger.w(log);

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值