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 ...
随机推荐
- HeapAlloc 和 GlobalAlloc 以及 VirtualAlloc 三者之间的关系(转)
VirtualAlloc 一次分配 1PAGE 以上的 RAM. 每次分配都是 PAGE 的整数倍. 你不会想为了分配 1 个 BYTE 的空间而浪费剩下的 4095 字节. OK, 你可以自己写算法 ...
- HOWTO: Get the command line of a process(转)
How would you get the command line of a process? Some people have suggested that you use remote thre ...
- mklink让网盘同步不同文件夹
mklink简介 Linux 下有一个叫符号链接的东东,是 ln 这个链接命令,mklink 和 ln 的功能几乎一样.在xp系统下,junction命令要用微软开发的小程序 junction.exe ...
- LINUX block I/O --systemtap
http://hushi55.github.io/2015/10/16/Block-Input-Output/ http://myaut.github.io/dtrace-stap-book/kern ...
- mybatis逆向工程--自动生成实体代码(mybatis-generator)
随便找个目录, 添加文件, 如图 主要是两个jar包, generator的下载路径: https://github.com/mybatis/generator/releases 驱动包随 ...
- HDU 2604 Queuing 矩阵高速幂
Queuing Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total S ...
- 使用Dictionary泛型集合封装业务逻辑判断 z
C#2.0 提供了Dictionary 泛型类,它提供了从一组键到一组值的映射.字典中的每个添加项都由一个值及其相关联的键组成.通过键来检索值的速度是非常快的,接近于 O(1),这是因为 Dictio ...
- EF三种加载方法
EF性能之关联加载 鱼和熊掌不能兼得 ——中国谚语 一.介绍 Entity Framework作为一个优秀的ORM框架,它使得操作数据库就像操作内存中的数据一样,但是这种抽象是有性能代价的,故鱼和 ...
- Windows Phone 7 开发环境的搭建
本节开始进行Windows Phone 开发环境的搭建,包括所需要的操作系统及硬件的介绍,开发工具的下载与安装,以及开发工具的介绍等.由于Jake Lin老师的视频中讲解的是早期的Windows Ph ...
- java执行ping命令
public static void get() throws IOException{ String address="10.132.118.110"; Process proc ...