LogUtils.java
package com.xdsjs.save.utils; /**
* 日志相关管理类
* Created by xdsjs on 2015/10/13.
*/ import android.util.Log; public class LogUtils { private LogUtils() {
/* cannot be instantiated */
throw new UnsupportedOperationException("cannot be instantiated");
} public static boolean isDebug = true;// 是否需要打印bug,可以在application的onCreate函数里面初始化
private static final String TAG = "-------------->"; //默认的Tag // 下面四个是默认tag的函数
public static void i(String msg) {
if (isDebug)
Log.i(TAG, msg);
} public static void d(String msg) {
if (isDebug)
Log.d(TAG, msg);
} public static void e(String msg) {
if (isDebug)
Log.e(TAG, msg);
} public static void v(String msg) {
if (isDebug)
Log.v(TAG, msg);
} // 下面是传入自定义tag的函数
public static void i(String tag, String msg) {
if (isDebug)
Log.i(tag, msg);
} public static void d(String tag, String msg) {
if (isDebug)
Log.i(tag, msg);
} public static void e(String tag, String msg) {
if (isDebug)
Log.i(tag, msg);
} public static void v(String tag, String msg) {
if (isDebug)
Log.i(tag, msg);
}
}
Android 相关日志代码:https://github.com/WecanStudio/Android/blob/master/%E5%B7%A5%E5%85%B7%E7%B1%BB/LogUtils.java
| package com.xdsjs.save.utils; | |
| /** | |
| * 日志相关管理类 | |
| * Created by xdsjs on 2015/10/13. | |
| */ | |
| import android.util.Log; | |
| public class LogUtils { | |
| private LogUtils() { | |
| /* cannot be instantiated */ | |
| throw new UnsupportedOperationException("cannot be instantiated"); | |
| } | |
| public static boolean isDebug = true;// 是否需要打印bug,可以在application的onCreate函数里面初始化 | |
| private static final String TAG = "-------------->"; //默认的Tag | |
| // 下面四个是默认tag的函数 | |
| public static void i(String msg) { | |
| if (isDebug) | |
| Log.i(TAG, msg); | |
| } | |
| public static void d(String msg) { | |
| if (isDebug) | |
| Log.d(TAG, msg); | |
| } | |
| public static void e(String msg) { | |
| if (isDebug) | |
| Log.e(TAG, msg); | |
| } | |
| public static void v(String msg) { | |
| if (isDebug) | |
| Log.v(TAG, msg); | |
| } | |
| // 下面是传入自定义tag的函数 | |
| public static void i(String tag, String msg) { | |
| if (isDebug) | |
| Log.i(tag, msg); | |
| } | |
| public static void d(String tag, String msg) { | |
| if (isDebug) | |
| Log.i(tag, msg); | |
| } | |
| public static void e(String tag, String msg) { | |
| if (isDebug) | |
| Log.i(tag, msg); | |
| } | |
| public static void v(String tag, String msg) { | |
| if (isDebug) | |
| Log.i(tag, msg); | |
| } | |
| } |
LogUtils.java的更多相关文章
- java se之File类
遍历某个目录路径下的所有文件并打印输出: package com.led.file; import java.io.File; public class File_List { public stat ...
- Nacos系列:Nacos的Java SDK使用
Maven依赖 Nacos提供完整的Java SDK,便于配置管理和服务发现及管理,以 Nacos-0.8.0 版本为例 添加Maven依赖: <dependency> <group ...
- Hive启动报错:java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument
报错详细: Exception in thread "main" java.lang.NoSuchMethodError: com.google.common.base.Preco ...
- 使用logback.xml配置来实现日志文件输出
转自:http://sungang-1120.iteye.com/blog/2104296 Logback是由log4j创始人设计的又一个开源日志组件.logback当前分成三个模块:logback- ...
- Caused by: org.xml.sax.SAXParseException; systemId: file:/home/hadoop/hive-0.12.0/conf/hive-site.xml; lineNumber: 5; columnNumber: 2; The markup in the document following the root element must be well
1:Hive安装的过程(Hive启动的时候报的错误),贴一下错误,和为什么错,以及解决方法: [root@master bin]# ./hive // :: INFO Configuration.de ...
- ElasticSearch踩坑记录
一.分词错误 [2018-02-06 14:28:30:098] --- [INFO] --- [CjhArticleSimilarityTask.java:66] --- [[SimilarityC ...
- android:Android开发不得不收藏的Utils
AndroidUtils AndroidUtils Android开发不得不收藏的Utils 之前写这篇文章主要是项目应用到的Utils,发现已经有一个更全面的开源库总结,所以还是非常震惊可以总结的这 ...
- 一脸懵逼学习Hive的元数据库Mysql方式安装配置
1:要想学习Hive必须将Hadoop启动起来,因为Hive本身没有自己的数据管理功能,全是依赖外部系统,包括分析也是依赖MapReduce: 2:七个节点跑HA集群模式的: 第一步:必须先将Zook ...
- Android开发各种Utils收集库
为方便查找,已进行大致归类,其目录如下所示: Activity相关→ActivityUtils.java→Demo isActivityExists : 判断是否存在Activity launchAc ...
随机推荐
- Aptana studio 3配色方案的修改方法
http://www.weste.net/2013/1-29/88614.html Aptana studio 3的确是一个不错的IDE,但是默认的黑底白色代码样式看时间长了有点审美疲劳了,如何能够更 ...
- Iterative (non-recursive) Quick Sort
An iterative way of writing quick sort: #include <iostream> #include <stack> #include &l ...
- 开启PowerDesigner15工具栏上的被禁用掉的图标
PowerDesigner 15 的版本,工具栏上的Inheritance图标默认是禁用的,如下图所示:
- vim 之cscope的使用
http://www.mcuos.com/thread-8488-1-1.html http://blog.csdn.net/longerzone/article/details/7789581 ht ...
- pytest文档27-pytest分布式执行(pytest-xdist)
前言 平常我们手工测试用例非常多时,比如有1千条用例,假设每个用例执行需要1分钟.如果一个测试人员执行需要1000分钟才能执行完,当项目非常紧急的时候, 我们会用测试人力成本换取时间成本,这个时候多找 ...
- [翻译] ClockView 时钟
ClockView 时钟 https://github.com/nacho4d/ClockView Overview ClockView is s simple class that will sim ...
- [翻译] 使用开源库 JGDownloadAcceleration 控制下载队列,断点下载,加速下载
JGDownloadAcceleration 本人对原文进行了翻译,凑合看看,使用心得以后补上 https://github.com/JonasGessner/JGDownloadAccelerati ...
- 某浪PHP面试题及答案优化
前几天一网友去国内某知名IT公司某浪面试PHP,在他谈心得的时候得一面试题,下面写问题答案及优化方案,希望大家多提提意见. “神马,杨辉三角?” 我估计太久不上学了,当年初中数学及大学C语言课上的杨辉 ...
- mysql搭建及数据迁移教程
1.如果jumbo不存在,先安装jumbo 参考 http://hetu.baidu.com/api/tool/show?toolId=174: bash -c "$( curl htt ...
- 树行控件TreeView 在WinForm下 怎么实现重命名功能
public Form1() { InitializeComponent(); this.Load+=new EventHandler(Form1_Load); treeVie ...