當前位置: 首頁>>代碼示例>>Java>>正文


Java Log.println方法代碼示例

本文整理匯總了Java中android.util.Log.println方法的典型用法代碼示例。如果您正苦於以下問題:Java Log.println方法的具體用法?Java Log.println怎麽用?Java Log.println使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.util.Log的用法示例。


在下文中一共展示了Log.println方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: log

import android.util.Log; //導入方法依賴的package包/類
public static void log(String tag, int level, Throwable t, Object... messages) {
    if (Log.isLoggable(tag, level)) {
        String message;
        if (t == null && messages != null && messages.length == 1) {
            // handle this common case without the extra cost of creating a stringbuffer:
            message = messages[0].toString();
        } else {
            StringBuilder sb = new StringBuilder();
            if (messages != null) for (Object m : messages) {
                sb.append(m);
            }
            if (t != null) {
                sb.append("\n").append(Log.getStackTraceString(t));
            }
            message = sb.toString();
        }
        Log.println(level, tag, message);
    }
}
 
開發者ID:adithya321,項目名稱:Instincts-2k17,代碼行數:20,代碼來源:LogHelper.java

示例2: println

import android.util.Log; //導入方法依賴的package包/類
/**
 * Prints data out to the console using Android's native log mechanism.
 * @param priority Log level of the data being logged.  Verbose, Error, etc.
 * @param tag Tag for for the log data.  Can be used to organize log statements.
 * @param msg The actual message to be logged. The actual message to be logged.
 * @param tr If an exception was thrown, this can be sent along for the logging facilities
 *           to extract and print useful information.
 */
@Override
public void println(int priority, String tag, String msg, Throwable tr) {
    // There actually are log methods that don't take a msg parameter.  For now,
    // if that's the case, just convert null to the empty string and move on.
    String useMsg = msg;
    if (useMsg == null) {
        useMsg = "";
    }

    // If an exeption was provided, convert that exception to a usable string and attach
    // it to the end of the msg method.
    if (tr != null) {
        msg += "\n" + Log.getStackTraceString(tr);
    }

    // This is functionally identical to Log.x(tag, useMsg);
    // For instance, if priority were Log.VERBOSE, this would be the same as Log.v(tag, useMsg)
    Log.println(priority, tag, useMsg);

    // If this isn't the last node in the chain, move things along.
    if (mNext != null) {
        mNext.println(priority, tag, msg, tr);
    }
}
 
開發者ID:hardik-dadhich,項目名稱:bluetooth-chat-appliction,代碼行數:33,代碼來源:LogWrapper.java

示例3: doLog

import android.util.Log; //導入方法依賴的package包/類
private void doLog(LogLevel level, String tag, String msg, Object ... args) {
    String formattedMsg = String.format(msg, args);
    String logMsg = String.format("%s %s/%s: %s\n", mDateFormat.format(new Date()), level.toString(),
                                  tag, formattedMsg);
    if (mLogWriter != null) {
        synchronized (mLogWriter) {
            try {
                mLogWriter.write(logMsg);
                mLogWriter.flush();
            } catch (IOException e) {
                Log.e(TAG, "Log IOException: " + e.getMessage());
            }
        }

        if (mLogFile.length() >= MAX_LOG_SIZE) {
            truncateLogs();
        }
    }

    if (level.toInt() >= mMinLogCatLvl.toInt()) {
        Log.println(level.toInt(), tag, formattedMsg);
    }
}
 
開發者ID:danvratil,項目名稱:FBEventSync,代碼行數:24,代碼來源:Logger.java

示例4: log

import android.util.Log; //導入方法依賴的package包/類
@Override
public void log(Level level, String msg, Throwable th) {
    if (level != Level.OFF) {
        // That's how Log does it internally
        Log.println(mapLevel(level), tag, msg + "\n" + Log.getStackTraceString(th));
    }
}
 
開發者ID:AweiLoveAndroid,項目名稱:OKEventBus,代碼行數:8,代碼來源:AndroidLogger.java

示例5: onResourceReady

import android.util.Log; //導入方法依賴的package包/類
@Override
public boolean onResourceReady(B resource, A model, Target<B> target, boolean isFromMemoryCache,
                               boolean isFirstResource) {
    String resourceString = strip(getResourceDescription(resource));
    String targetString = strip(getTargetDescription(target));
    Log.println(level, "GLIDE", String.format(Locale.ROOT,
            "%s.onResourceReady(%s, %s, %s, %s, %s)",
            name, resourceString, model, targetString, isMem(isFromMemoryCache), isFirst(isFirstResource)));
    return delegate.onResourceReady(resource, model, target, isFromMemoryCache, isFirstResource);
}
 
開發者ID:RahulJanagouda,項目名稱:StatusStories,代碼行數:11,代碼來源:LoggingListener.java

示例6: printHead

import android.util.Log; //導入方法依賴的package包/類
private static void printHead(final int type, final String tag, final String[] head) {
    if (head != null) {
        for (String aHead : head) {
            Log.println(type, tag, sLogBorderSwitch ? LEFT_BORDER + aHead : aHead);
        }
        if (sLogBorderSwitch) Log.println(type, tag, MIDDLE_BORDER);
    }
}
 
開發者ID:Blankj,項目名稱:ALog,代碼行數:9,代碼來源:ALog.java

示例7: log

import android.util.Log; //導入方法依賴的package包/類
private static void log(String tag, String msg, LogLevel level){
  if (WXEnvironment.isApkDebugable() && msg != null && WXEnvironment.sLogLevel.compare(level) >= 0) {
    msg = getLineNumber() + msg;
    Log.println(level.getPriority(),tag, msg);
    writeConsoleLog(level.getName(), msg);
    sendLog(level, msg);
  }
}
 
開發者ID:erguotou520,項目名稱:weex-uikit,代碼行數:9,代碼來源:WXLogUtils.java

示例8: log

import android.util.Log; //導入方法依賴的package包/類
@Override public void log(int level, String message, Throwable t) {
  int logLevel = level == WARN ? Log.WARN : Log.DEBUG;
  if (t != null) message = message + '\n' + Log.getStackTraceString(t);

  // Split by line, then ensure each line can fit into Log's maximum length.
  for (int i = 0, length = message.length(); i < length; i++) {
    int newline = message.indexOf('\n', i);
    newline = newline != -1 ? newline : length;
    do {
      int end = Math.min(newline, i + MAX_LOG_LENGTH);
      Log.println(logLevel, "OkHttp", message.substring(i, end));
      i = end;
    } while (i < newline);
  }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:16,代碼來源:AndroidPlatform.java

示例9: d

import android.util.Log; //導入方法依賴的package包/類
private static void d(int i, String str, String str2) {
    if (!d) {
        str = "FlurryAgent";
    }
    int length = TextUtils.isEmpty(str2) ? 0 : str2.length();
    int i2 = 0;
    while (i2 < length) {
        int i3 = a > length - i2 ? length : a + i2;
        if (Log.println(i, str, str2.substring(i2, i3)) > 0) {
            i2 = i3;
        } else {
            return;
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:16,代碼來源:ib.java

示例10: log

import android.util.Log; //導入方法依賴的package包/類
@Override
public void log(int priority, String tag, String message) {
  Log.println(priority, tag, message);
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:5,代碼來源:LogcatLogStrategy.java

示例11: printBorder

import android.util.Log; //導入方法依賴的package包/類
private static void printBorder(final int type, final String tag, boolean isTop) {
    if (sLogBorderSwitch) {
        Log.println(type, tag, isTop ? TOP_BORDER : BOTTOM_BORDER);
    }
}
 
開發者ID:Blankj,項目名稱:ALog,代碼行數:6,代碼來源:ALog.java

示例12: print

import android.util.Log; //導入方法依賴的package包/類
private static void print(final int type, final String tag, final String msg) {
    Log.println(type, tag, msg);
}
 
開發者ID:Wilshion,項目名稱:HeadlineNews,代碼行數:4,代碼來源:LogUtils.java

示例13: println

import android.util.Log; //導入方法依賴的package包/類
/**
 * Prints a message using this configuration.
 */
private void println(String message) {
    Log.println(level, tag, message);
}
 
開發者ID:SlotNSlot,項目名稱:SlotNSlot_Android,代碼行數:7,代碼來源:AndroidHttpClient.java

示例14: println

import android.util.Log; //導入方法依賴的package包/類
private void println(int priority, String tag, String msg, Throwable tr) {
  Log.println(priority, prefixTag(tag), getMsg(msg, tr));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:FLogDefaultLoggingDelegate.java

示例15: log

import android.util.Log; //導入方法依賴的package包/類
@Override public void log(int priority, String tag, String message) {
  Log.println(priority, tag, message);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:LogcatLogStrategy.java


注:本文中的android.util.Log.println方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。