Useful Log Printing class

Source: Internet
Author: User

Package Com.huawei.network.ott.weixin.util;import Android.util.log;public Final class Debuglog {/** * description level Log ID, This level is the lowest log level, and when published, */public static final int VERBOSE = 0;/** * Debug level Log ID is used primarily for printing debugging information and will be closed when publishing */public static final int DEBUG = 1;/** * Information level log ID, mainly used for printing data, properties and other information, publish will be closed */public static final int info = 2;/** * Warning level of the log ID, mainly used for printing warnings, publish without closing */public stat IC final int WARN = 3;/** * ERROR level Log ID, primarily for printing errors, not closed */public static final int error = 4;private static Boolean Isprintlo g = true;private static int logLevel = verbose;/** * Print log * * @return */public static Boolean Isprintlog () {return ISPR Intlog;} /** * Set whether to print log * * @param isprintlog * If set to True, the log is printed, otherwise the log */public static void Setprintlog (Boolean ispri Ntlog) {debuglog.isprintlog = Isprintlog;} /** * Gets the current log print minimum level * * @return */public static int getloglevel () {return logLevel;} /** * Sets the minimum level of print for the current log * * @param logLevel */public static void setloglevel (int logLevel) {debuglog.loglevel = LogLevel;} /** * Print a {@link#VERBOSE} log information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged.  */public static int V (string tag, string msg) {if (Isprintlog && VERBOSE >= logLevel) {return LOG.V (tag, msg);} else {return-1;}} /** * Print a {@link #VERBOSE} log information and print the exception information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged. * @param TR * An exception to log */public static int V (string tag, string msg, Throwable tr) {if (Isprintlog & amp;& VERBOSE >= logLevel) {return LOG.V (tag, MSG, TR);} else {return-1;}} /** * Print a {@link #DEBUG} log information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or actIvity where the log call occurs. * @param msg * The message would like logged. */public static int d (string tag, string msg) {if (Isprintlog && DEBUG >= logLevel) {return LOG.D (tag, msg);} E LSE {return-1;}} /** * Print a {@link #DEBUG} log information and print the exception information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged. * @param TR * An exception to log */public static int d (string tag, string msg, Throwable tr) {if (Isprintlog & amp;& DEBUG >= logLevel) {return LOG.D (tag, MSG, TR);} else {return-1;}} /** * Print a {@link #INFO} log information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged. */public static int I (string tag, string msg) {if (ISPRIntlog && INFO >= logLevel) {return log.i (tag, msg);} else {return-1;}} /** * Print a {@link #INFO} log information and print the exception information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged. * @param TR * An exception to log */public static int i (string tag, string msg, Throwable tr) {if (Isprintlog & amp;& INFO >= logLevel) {return log.i (tag, MSG, TR);} else {return-1;}} /** * Print a {@link #WARN} log information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged. */public Static int W (string tag, string msg) {if (Isprintlog && WARN >= logLevel) {return LOG.W (tag, msg);} El se {return-1;}} /** * Print a {@link #WARN} exception information. * * @param tag * used to IDentify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged. */public Static int W (String tag, throwable tr) {if (Isprintlog && WARN >= logLevel) {return LOG.W (tag, tr);} E LSE {return-1;}} /** * Print a {@link #WARN} log information and print the exception information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged. * @param TR * An exception to log */public static int W (string tag, string msg, Throwable tr) {if (Isprintlog & amp;& WARN >= logLevel) {return LOG.W (tag, MSG, TR);} else {return-1;}} /** * Print a {@link #ERROR} log information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * the Message would like logged. */public static int E (string tag, string msg) {if (Isprintlog && ERROR >= logLevel) {return LOG.E (tag, msg);} E LSE {return-1;}} /** * Print a {@link #ERROR} log information and print the exception information. * * @param tag * Used to identify the source of a log message. It usually * identifies the class or activity where the log call occurs. * @param msg * The message would like logged. * @param TR * An exception to log */public static int e (string tag, string msg, Throwable tr) {if (Isprintlog & amp;& ERROR >= logLevel) {return LOG.E (tag, MSG, TR);} else {return-1;}}}

  

Useful Log Printing class

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.