From 91f7f2acac96f2bf8b0cf726135652ccd92fc98f Mon Sep 17 00:00:00 2001 From: Neal Nguyen Date: Fri, 2 Apr 2010 16:42:26 -0700 Subject: Moved log formatting string into separate function so it can be resued by others. Change-Id: I4e97d950587822c3a3e24c1c3d1a89ab19419f14 --- ddms/libs/ddmlib/src/com/android/ddmlib/Log.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ddms/libs/ddmlib/src/com/android/ddmlib/Log.java b/ddms/libs/ddmlib/src/com/android/ddmlib/Log.java index ce95b04..e24c353 100644 --- a/ddms/libs/ddmlib/src/com/android/ddmlib/Log.java +++ b/ddms/libs/ddmlib/src/com/android/ddmlib/Log.java @@ -337,13 +337,21 @@ public final class Log { * @param message */ public static void printLog(LogLevel logLevel, String tag, String message) { + System.out.print(getLogFormatString(logLevel, tag, message)); + } + + /** + * Formats a log message. + * @param logLevel + * @param tag + * @param message + */ + public static String getLogFormatString(LogLevel logLevel, String tag, String message) { long msec; msec = System.currentTimeMillis(); - String outMessage = String.format("%02d:%02d %c/%s: %s\n", - (msec / 60000) % 60, (msec / 1000) % 60, + return String.format("%02d:%02d %c/%s: %s\n", (msec / 60000) % 60, (msec / 1000) % 60, logLevel.getPriorityLetter(), tag, message); - System.out.print(outMessage); } } -- cgit v1.1