当前位置: 首页>>代码示例>>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;未经允许,请勿转载。