diff options
author | Neal Nguyen <tommyn@google.com> | 2010-04-02 16:42:26 -0700 |
---|---|---|
committer | Neal Nguyen <tommyn@google.com> | 2010-04-05 11:11:49 -0700 |
commit | 91f7f2acac96f2bf8b0cf726135652ccd92fc98f (patch) | |
tree | 65dc6f993971df39cc2c2b66f8361b590abc93bc | |
parent | 58e510428f69a020487520e9d995dee5291b44be (diff) | |
download | sdk-91f7f2acac96f2bf8b0cf726135652ccd92fc98f.zip sdk-91f7f2acac96f2bf8b0cf726135652ccd92fc98f.tar.gz sdk-91f7f2acac96f2bf8b0cf726135652ccd92fc98f.tar.bz2 |
Moved log formatting string into separate function so it can be resued by others.
Change-Id: I4e97d950587822c3a3e24c1c3d1a89ab19419f14
-rw-r--r-- | ddms/libs/ddmlib/src/com/android/ddmlib/Log.java | 14 |
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); } } |