本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}
示例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));
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
}
示例10: log
import android.util.Log; //导入方法依赖的package包/类
@Override
public void log(int priority, String tag, String message) {
Log.println(priority, tag, message);
}
示例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);
}
}
示例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);
}
示例13: println
import android.util.Log; //导入方法依赖的package包/类
/**
* Prints a message using this configuration.
*/
private void println(String message) {
Log.println(level, tag, message);
}
示例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));
}
示例15: log
import android.util.Log; //导入方法依赖的package包/类
@Override public void log(int priority, String tag, String message) {
Log.println(priority, tag, message);
}