diff options
author | Sohani Rao <sohanirao@google.com> | 2016-12-22 10:42:42 -0800 |
---|---|---|
committer | Sohani Rao <sohanirao@google.com> | 2016-12-23 00:21:18 +0000 |
commit | 64acb4210ced1920fc29caa98a353b2968fd33b5 (patch) | |
tree | b6ac2c66acaa736bbe8ba1750abc7805cb1a3962 /service | |
parent | 29074fe3d2125eeb33db6b9d4425b54e72036661 (diff) |
Add method to handle boolean arguments to log
Overload LogMessage's c() function with boolean argument
Change-Id: I33cc6478b8f4f46f6f990933c0cb1a3011afcc84
Bug: 33839553
Test: Unit tests
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/DummyLogMessage.java | 5 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/LogcatLog.java | 10 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiLog.java | 7 |
3 files changed, 22 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/DummyLogMessage.java b/service/java/com/android/server/wifi/DummyLogMessage.java index 726e44562..7eafcc701 100644 --- a/service/java/com/android/server/wifi/DummyLogMessage.java +++ b/service/java/com/android/server/wifi/DummyLogMessage.java @@ -39,6 +39,11 @@ public class DummyLogMessage implements WifiLog.LogMessage { } @Override + public WifiLog.LogMessage c(boolean value) { + return this; + } + + @Override public void flush() { // Nothing to do. } diff --git a/service/java/com/android/server/wifi/LogcatLog.java b/service/java/com/android/server/wifi/LogcatLog.java index 0bba098a1..ffe89505e 100644 --- a/service/java/com/android/server/wifi/LogcatLog.java +++ b/service/java/com/android/server/wifi/LogcatLog.java @@ -173,6 +173,16 @@ class LogcatLog implements WifiLog { } @Override + public WifiLog.LogMessage c(boolean value) { + copyUntilPlaceholder(); + if (mNextFormatCharPos < mFormat.length()) { + mStringBuilder.append(value); + ++mNextFormatCharPos; + } + return this; + } + + @Override public void flush() { if (mNextFormatCharPos < mFormat.length()) { mStringBuilder.append(mFormat, mNextFormatCharPos, mFormat.length()); diff --git a/service/java/com/android/server/wifi/WifiLog.java b/service/java/com/android/server/wifi/WifiLog.java index 859fec4d9..24dcda67c 100644 --- a/service/java/com/android/server/wifi/WifiLog.java +++ b/service/java/com/android/server/wifi/WifiLog.java @@ -187,6 +187,13 @@ public interface WifiLog { LogMessage c(char value); /** + * Like {@link #c(String) c(String)}, except that the value is a boolean. + */ + @CheckReturnValue + @NonNull + LogMessage c(boolean value); + + /** * Write this LogMessage to the logging daemon. Writing the * message is best effort. More specifically: * 1) The operation is non-blocking. If we’re unable to write |