diff options
author | Xavier Ducrohet <xav@android.com> | 2012-08-16 19:28:20 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2012-08-17 11:36:32 -0700 |
commit | ae6a209f6f4030e1ebe20118f9455547e4cd50fc (patch) | |
tree | f61ce892f88e3bee449eb6dddc8f820a4bfa6f1e /manifmerger | |
parent | 8863aa8bdefdc769f483f72ab90b3d9d97aba212 (diff) | |
download | sdk-ae6a209f6f4030e1ebe20118f9455547e4cd50fc.zip sdk-ae6a209f6f4030e1ebe20118f9455547e4cd50fc.tar.gz sdk-ae6a209f6f4030e1ebe20118f9455547e4cd50fc.tar.bz2 |
Unify all loggers in the sdk tools.
Removed ILogger from ide_common
Removed ISdkLog (and implementations) from sdklib
Moved all existing code to com.android.utils.ILogger
which is located in common.
Change-Id: Icd674d4b8d10f6ae8b60a83acb43cc53c7a52137
Diffstat (limited to 'manifmerger')
4 files changed, 16 insertions, 41 deletions
diff --git a/manifmerger/src/com/android/manifmerger/ArgvParser.java b/manifmerger/src/com/android/manifmerger/ArgvParser.java index 5aed998..6d22f57 100755 --- a/manifmerger/src/com/android/manifmerger/ArgvParser.java +++ b/manifmerger/src/com/android/manifmerger/ArgvParser.java @@ -16,8 +16,8 @@ package com.android.manifmerger; -import com.android.sdklib.ISdkLog; import com.android.sdklib.util.CommandLineParser; +import com.android.utils.ILogger; import java.util.List; @@ -64,7 +64,7 @@ class ArgvParser extends CommandLineParser { }; - public ArgvParser(ISdkLog logger) { + public ArgvParser(ILogger logger) { super(logger, ACTIONS); // The following defines the parameters of the actions defined in mAction. diff --git a/manifmerger/src/com/android/manifmerger/Main.java b/manifmerger/src/com/android/manifmerger/Main.java index 93057fc..78da1a3 100644 --- a/manifmerger/src/com/android/manifmerger/Main.java +++ b/manifmerger/src/com/android/manifmerger/Main.java @@ -16,7 +16,8 @@ package com.android.manifmerger; -import com.android.sdklib.ISdkLog; +import com.android.utils.ILogger; +import com.android.utils.StdLogger; import java.io.File; @@ -37,7 +38,7 @@ import java.io.File; public class Main { /** Logger object. Use this to print normal output, warnings or errors. Never null. */ - private ISdkLog mSdkLog; + private ILogger mSdkLog; /** Command line parser. Never null. */ private ArgvParser mArgvParser; @@ -77,37 +78,11 @@ public class Main { * This logger prints to the attached console. */ private void createLogger() { - mSdkLog = new ISdkLog() { - @Override - public void error(Throwable t, String errorFormat, Object... args) { - if (errorFormat != null) { - System.err.printf("Error: " + errorFormat, args); - if (!errorFormat.endsWith("\n")) { - System.err.printf("\n"); - } - } - if (t != null) { - System.err.printf("Error: %s\n", t.getMessage()); - } - } - - @Override - public void warning(String warningFormat, Object... args) { - System.out.printf("Warning: " + warningFormat, args); - if (!warningFormat.endsWith("\n")) { - System.out.printf("\n"); - } - } - - @Override - public void printf(String msgFormat, Object... args) { - System.out.printf(msgFormat, args); - } - }; + mSdkLog = new StdLogger(StdLogger.Level.VERBOSE); } /** For testing */ - public void setLogger(ISdkLog logger) { + public void setLogger(ILogger logger) { mSdkLog = logger; } diff --git a/manifmerger/src/com/android/manifmerger/MergerLog.java b/manifmerger/src/com/android/manifmerger/MergerLog.java index c1f8cb2..446898c 100755 --- a/manifmerger/src/com/android/manifmerger/MergerLog.java +++ b/manifmerger/src/com/android/manifmerger/MergerLog.java @@ -18,7 +18,7 @@ package com.android.manifmerger; import com.android.annotations.NonNull; import com.android.annotations.Nullable; -import com.android.sdklib.ISdkLog; +import com.android.utils.ILogger; /** @@ -27,12 +27,12 @@ import com.android.sdklib.ISdkLog; public abstract class MergerLog { /** - * Create a new instance of a {@link MergerLog} that prints to an {@link ISdkLog}. + * Create a new instance of a {@link MergerLog} that prints to an {@link ILogger}. * - * @param sdkLog A non-null {@link ISdkLog}. + * @param sdkLog A non-null {@link ILogger}. * @return A new IMergerLog. */ - public static IMergerLog wrapSdkLog(final @NonNull ISdkLog sdkLog) { + public static IMergerLog wrapSdkLog(final @NonNull ILogger sdkLog) { return new IMergerLog() { @Override public void error( @@ -43,7 +43,7 @@ public abstract class MergerLog { switch(severity) { case INFO: - sdkLog.printf( + sdkLog.info( "[%1$s] %2$s", //$NON-NLS-1$ location, String.format(message, msgParams)); @@ -72,7 +72,7 @@ public abstract class MergerLog { switch(severity) { case INFO: - sdkLog.printf( + sdkLog.info( "[%1$s, %2$s] %3$s", //$NON-NLS-1$ location1, location2, diff --git a/manifmerger/src/com/android/manifmerger/XmlUtils.java b/manifmerger/src/com/android/manifmerger/XmlUtils.java index 778abea..f60d300 100755 --- a/manifmerger/src/com/android/manifmerger/XmlUtils.java +++ b/manifmerger/src/com/android/manifmerger/XmlUtils.java @@ -20,7 +20,7 @@ import com.android.annotations.NonNull; import com.android.annotations.Nullable; import com.android.manifmerger.IMergerLog.FileAndLine; import com.android.manifmerger.IMergerLog.Severity; -import com.android.sdklib.ISdkLog; +import com.android.utils.ILogger; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -67,7 +67,7 @@ class XmlUtils { * You can retrieve this file later by using {@link #extractXmlFilename(Node)}. * * @param xmlFile The XML {@link File} to parse. Must not be null. - * @param log An {@link ISdkLog} for reporting errors. Must not be null. + * @param log An {@link ILogger} for reporting errors. Must not be null. * @return A new DOM {@link Document}, or null. */ @Nullable @@ -131,7 +131,7 @@ class XmlUtils { * It is namespace aware. * * @param xml The XML string to parse. Must not be null. - * @param log An {@link ISdkLog} for reporting errors. Must not be null. + * @param log An {@link ILogger} for reporting errors. Must not be null. * @return A new DOM {@link Document}, or null. */ @Nullable |