• <li id="00i08"><input id="00i08"></input></li>
  • <sup id="00i08"><tbody id="00i08"></tbody></sup>
    <abbr id="00i08"></abbr>
  • 新聞中心

    EEPW首頁 > 嵌入式系統 > 設計應用 > Android 框架簡介

    Android 框架簡介

    作者: 時間:2016-09-12 來源:網絡 收藏

    * INFO will be logged. Before you make any calls to a logging method you should check to see

    * if your tag should be logged. You can change the default level by setting a system property:

    * 'setprop log.tag. '

    * Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPPRESS will

    * turn off all logging for your tag. You can also create a local.prop file that with the

    * following in it:

    * 'log.tag.='

    * and place that in /data/local.prop.

    *

    * @param tag The tag to check.

    * @param level The level to check.

    * @return Whether or not that this is allowed to be logged.

    * @throws IllegalArgumentException is thrown if the tag.length() > 23.

    */

    public static native boolean isLoggable(String tag, int level);

    /**

    * Send a {@link #WARN} log message and log the exception.

    * @param tag Used to identify the source of a log message. It usually identifies

    * the class or activity where the log call occurs.

    * @param tr An exception to log

    */

    public static int w(String tag, Throwable tr) {

    return println_native(LOG_ID_MAIN, WARN, tag, getStackTraceString(tr));

    }

    /**

    * Send an {@link #ERROR} log message.

    * @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 you would like logged.

    */

    public static int e(String tag, String msg) {

    return println_native(LOG_ID_MAIN, ERROR, tag, msg);

    }

    /**

    * Send a {@link #ERROR} log message and log the exception.

    * @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 you would like logged.

    * @param tr An exception to log

    */

    public static int e(String tag, String msg, Throwable tr) {

    return println_native(LOG_ID_MAIN, ERROR, tag, msg + '/n' + getStackTraceString(tr));

    }

    /**

    * What a Terrible Failure: Report a condition that should never happen.

    * The error will always be logged at level ASSERT with the call stack.

    * Depending on system configuration, a report may be added to the

    * {@link .os.DropBoxManager} and/or the process may be terminated

    * immediately with an error dialog.

    * @param tag Used to identify the source of a log message.

    * @param msg The message you would like logged.

    */

    public static int wtf(String tag, String msg) {

    return wtf(tag, msg, null);

    }

    /**

    * What a Terrible Failure: Report an exception that should never happen.

    * Similar to {@link #wtf(String, String)}, with an exception to log.

    * @param tag Used to identify the source of a log message.

    * @param tr An exception to log.

    */

    public static int wtf(String tag, Throwable tr) {

    return wtf(tag, tr.getMessage(), tr);

    }

    /**

    * What a Terrible Failure: Report an exception that should never happen.

    * Similar to {@link #wtf(String, Throwable)}, with a message as well.

    * @param tag Used to identify the source of a log message.

    * @param msg The message you would like logged.

    * @param tr An exception to log. May be null.

    */

    public static int wtf(String tag, String msg, Throwable tr) {

    tr = new TerribleFailure(msg, tr);

    int bytes = println_native(LOG_ID_MAIN, ASSERT, tag, getStackTraceString(tr));

    RuntimeInit.wtf(tag, tr);

    return bytes;

    }

    /**

    * Handy function to get a loggable stack trace from a Throwable

    * @param tr An exception to log

    */

    public static String getStackTraceString(Throwable tr) {

    if (tr == null) {

    return ;

    }

    StringWriter sw = new StringWriter();

    PrintWriter pw = new PrintWriter(sw);

    tr.printStackTrace(pw);

    return sw.toString();

    }

    /**

    * Low-level logging call.

    * @param priority The priority/type of this log message

    * @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 you would like logged.

    * @return The number of bytes written.

    */

    public static int println(int priority, String tag, String msg) {

    return println_native(LOG_ID_MAIN, priority, tag, msg);

    }

    /** @hide */ public static final int LOG_ID_MAIN = 0;

    /** @hide */ public static final int LOG_ID_RADIO = 1;

    /** @hide */ public static final int LOG_ID_EVENTS = 2;



    關鍵詞: Android 框架簡介

    評論


    相關推薦

    技術專區

    關閉
    主站蜘蛛池模板: 武强县| 宁城县| 昌黎县| 徐闻县| 四会市| 疏勒县| 太和县| 子长县| 宕昌县| 旌德县| 新化县| 民勤县| 灵山县| 苗栗县| 唐海县| 大连市| 图们市| 双峰县| 长兴县| 武胜县| 芦溪县| 山丹县| 平顶山市| 芒康县| 保山市| 藁城市| 麻城市| 新野县| 苍梧县| 绵竹市| 汉川市| 万年县| 华安县| 全南县| 琼海市| 萝北县| 玉屏| 塔河县| 安岳县| 洪洞县| 霞浦县|