aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Nguyen <tommyn@google.com>2010-04-16 10:41:54 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-04-16 10:41:54 -0700
commitdd47b5fd5a36ca572125a50ea50fb217b865cad7 (patch)
tree99d29ebec35bfb53f9d6d5bf023eb196f9e72765
parent910fe5a020f09122e100a2c3beb5573a3182c596 (diff)
parent91f7f2acac96f2bf8b0cf726135652ccd92fc98f (diff)
downloadsdk-dd47b5fd5a36ca572125a50ea50fb217b865cad7.zip
sdk-dd47b5fd5a36ca572125a50ea50fb217b865cad7.tar.gz
sdk-dd47b5fd5a36ca572125a50ea50fb217b865cad7.tar.bz2
Merge "Moved log formatting string into separate function so it can be resued by others."
-rw-r--r--ddms/libs/ddmlib/src/com/android/ddmlib/Log.java14
1 files 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);
}
}