Android.util.Log class that can be conveniently used to print the log during encoding debugging. However, in a post-release product, if there is too much log printing, it can seriously affect performance. make a simple package for the Android.util.Log class and set debug to False when the product is to be published.
The code is as follows.
public class logutils{/** is formally set to false*/private static final Boolean Debug = true; private static final String TAG = "OYP"; public static void I (string tag, string msg) {if (Debug) android.util.log.i (tag, tag + msg); } public static void D (string tag, string msg) {if (Debug) ANDROID.UTIL.LOG.D (tag, tag + msg); } public static void W (string tag, string msg) {if (Debug) ANDROID.UTIL.LOG.W (tag, tag + msg); } public static void W (string tag, string msg, Throwable tr) {if (Debug) ANDROID.UTIL.LOG.W (tag, tag + MSG, TR); public static void V (string tag, string msg) {if (Debug) ANDROID.UTIL.LOG.V (tag, tag + msg); } public static void E (string tag, string msg) {ANDROID.UTIL.LOG.E (tag, tag + msg); public static void E (string tag, string msg, Throwable tr) {ANDROID.UTIL.LOG.E (tag, tag + msg, TR); }}
==================================================================================================
Ouyangpeng welcome reprint, sharing with people is the source of progress!
Reprint please keep the original address : Http://blog.csdn.net/ouyang_peng
==================================================================================================
Copyright NOTICE: This article for Bo Master original article, welcome reprint, reprint please indicate source Http://blog.csdn.net/ouyang_peng
My Android Step-by-step tour------>android A simple package for log