Skip to content

Commit

Permalink
Clean up logs (#2521)
Browse files Browse the repository at this point in the history
Remove unnecessary logs.

Related: [Remove unneeded logs by rpdome · Pull Request #2974 ·
AzureAD/ad-accounts-for-android
(github.com)](AzureAD/ad-accounts-for-android#2974)
  • Loading branch information
rpdome authored Oct 25, 2024
1 parent 8b5d9f9 commit f625a4e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
Logger.info(methodTag,
"Result received from Broker "
+ "Request code: " + requestCode
+ " Result code: " + requestCode
+ " Result code: " + resultCode
);

mBrokerResultReceived = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import com.microsoft.identity.common.java.WarningType;
import com.microsoft.identity.common.java.exception.ClientException;
import com.microsoft.identity.common.java.logging.Logger;
import com.microsoft.identity.common.java.nativeauth.authorities.NativeAuthCIAMAuthority;
import com.microsoft.identity.common.java.providers.microsoft.azureactivedirectory.AzureActiveDirectory;
import com.microsoft.identity.common.java.providers.microsoft.azureactivedirectory.AzureActiveDirectorySlice;
import com.microsoft.identity.common.java.providers.oauth2.OAuth2Strategy;
import com.microsoft.identity.common.java.providers.oauth2.OAuth2StrategyParameters;
import com.microsoft.identity.common.java.util.CommonURIBuilder;
import com.microsoft.identity.common.java.util.StringUtil;
import com.microsoft.identity.common.java.nativeauth.authorities.NativeAuthCIAMAuthority;

import java.io.IOException;
import java.net.MalformedURLException;
Expand Down Expand Up @@ -305,14 +305,13 @@ public int hashCode() {
private static void performCloudDiscovery()
throws IOException, URISyntaxException {
final String methodName = ":performCloudDiscovery";
Logger.info(
Logger.verbose(
TAG + methodName,
"Performing cloud discovery..."
);
synchronized (sLock) {
Logger.info(TAG + methodName, "Acquired lock.");
if (!AzureActiveDirectory.isInitialized()) {
Logger.info(TAG + methodName, "Not initialized. Starting request.");
Logger.verbose(TAG + methodName, "Not initialized. Starting request.");
AzureActiveDirectory.performCloudDiscovery();
Logger.info(TAG + methodName, "Loaded cloud metadata.");
}
Expand Down Expand Up @@ -389,10 +388,6 @@ public static KnownAuthorityResult getKnownAuthorityResult(Authority authority)
boolean known = false;

try {
Logger.info(
TAG + methodName,
"Performing cloud discovery"
);
performCloudDiscovery();
} catch (final IOException ex) {
clientException = new ClientException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ public static synchronized void performCloudDiscovery()
// until the app is killed.
HttpCache.flush();

Logger.info(TAG + methodName, "Parsing response.");
AzureActiveDirectoryInstanceResponse instanceResponse =
final AzureActiveDirectoryInstanceResponse instanceResponse =
ObjectMapper.deserializeJsonStringToObject(
response.getBody(),
AzureActiveDirectoryInstanceResponse.class
);
Logger.info(TAG + methodName, "Discovered ["

Logger.verbose(TAG + methodName, "Discovered ["
+ instanceResponse.getClouds().size() + "] clouds.");

for (final AzureActiveDirectoryCloud cloud : instanceResponse.getClouds()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private LocalAuthenticationResult(@NonNull final ICacheRecord cacheRecord, @NonN
cacheRecord.getIdToken();
if (idTokenRecord != null) {
mRawIdToken = idTokenRecord.getSecret();
Logger.info(TAG, "Id Token type: " +
Logger.verbose(TAG, "Id Token type: " +
idTokenRecord.getCredentialType());
} else if (cacheRecord.getV1IdToken() != null) {
// For all AAD requests, we hit the V2 endpoint, so the id token returned will be of version 2.0 (V2 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,9 @@ public static <T extends CharSequence> String join(final CharSequence separator,
*/
public static void throwIfArgumentIsNullOrEmpty(final @Nullable String argument,
final @NonNull String argumentName,
final @NonNull String methodName) throws NullPointerException {
final @NonNull String methodTag) throws NullPointerException {
if (isNullOrEmpty(argument)) {
Logger.error(TAG + methodName, argumentName + " is null or empty.", null);
Logger.error(methodTag, argumentName + " is null or empty.", null);
throw new NullPointerException(argumentName + " is null or empty.");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public static boolean equals(@Nullable final Object o1, @Nullable final Object o
*/
public static void throwIfArgumentIsNull(final @Nullable Object argument,
final @NonNull String argumentName,
final @NonNull String methodName) throws NullPointerException {
final @NonNull String methodTag) throws NullPointerException {
if (argument == null) {
Logger.error(TAG + methodName, argumentName + " is null.", null);
Logger.error(methodTag, argumentName + " is null.", null);
throw new NullPointerException(argumentName + " is null.");
}
}
Expand Down

0 comments on commit f625a4e

Please sign in to comment.