public final class Logger
extends java.lang.Object
Logger.getInstance().setEnableLogcatLog(false);
To enable the custom logger, set the external logger implementing
ILoggerCallback
.
Logger.getInstance().setExternalLogger(new Logger.ILoggerCallback() {
@Override
public void log(String tag, Logger.LogLevel logLevel, String message,
boolean containsPII) { }
});
Loglevel can be specified at Logger.LogLevel.ERROR
, Logger.LogLevel.WARNING
, Logger.LogLevel.INFO
and Logger.LogLevel.VERBOSE
. The sdk enables the verbose level logging by default, to set different
level logging:
Logger.getInstance().setLogLevel(Loglevel)
By default, the sdk doesn't send any log messages that contain PII (personal identifiable information) info. To enable PII
logging:
Logger.getInstance().setEnablePII(true);
Modifier and Type | Class and Description |
---|---|
static class |
Logger.LogLevel
Enum class for LogLevel that the sdk recognizes.
|
Constructor and Description |
---|
Logger() |
Modifier and Type | Method and Description |
---|---|
static void |
error(java.lang.String tag,
com.microsoft.identity.client.RequestContext requestContext,
java.lang.String errorMessage,
java.lang.Throwable exception)
Deprecated.
use
com.microsoft.identity.common.internal.logging.Logger#error(String, String, String, Throwable) instead. |
static void |
errorPII(java.lang.String tag,
com.microsoft.identity.client.RequestContext requestContext,
java.lang.String errorMessage,
java.lang.Throwable exception)
Deprecated.
use
com.microsoft.identity.common.internal.logging.Logger#errorPII(String, String, String, Throwable) instead. |
static Logger |
getInstance() |
void |
setEnableLogcatLog(boolean enableLogcatLog)
Enable/Disable the Android logcat logging.
|
void |
setEnablePII(boolean enablePII)
Enable log message with PII (personal identifiable information) info.
|
void |
setExternalLogger(ILoggerCallback externalLogger)
Set the custom logger.
|
void |
setLogLevel(Logger.LogLevel logLevel)
Set the log level for diagnostic purpose.
|
static void |
warning(java.lang.String tag,
com.microsoft.identity.client.RequestContext requestContext,
java.lang.String message)
Deprecated.
use
com.microsoft.identity.common.internal.logging.Logger#warn(String, String, String) instead. |
static void |
warningPII(java.lang.String tag,
com.microsoft.identity.client.RequestContext requestContext,
java.lang.String message)
Deprecated.
use
com.microsoft.identity.common.internal.logging.Logger#warnPII(String, String, String) instead. |
public void setLogLevel(Logger.LogLevel logLevel)
logLevel
- The Logger.LogLevel
to be enabled for the diagnostic logging.public void setExternalLogger(ILoggerCallback externalLogger)
externalLogger
- The reference to the ILoggerCallback
that can
output the logs to the designated places.java.lang.IllegalStateException
- if external logger is already set, and the caller is trying to set it again.public void setEnableLogcatLog(boolean enableLogcatLog)
enableLogcatLog
- True if enabling the logcat logging, false otherwise.public void setEnablePII(boolean enablePII)
enablePII
- True if enabling PII info to be logged, false otherwise.@Deprecated public static void error(java.lang.String tag, com.microsoft.identity.client.RequestContext requestContext, java.lang.String errorMessage, java.lang.Throwable exception)
com.microsoft.identity.common.internal.logging.Logger#error(String, String, String, Throwable)
instead.Logger.LogLevel.ERROR
log message without PII.@Deprecated public static void errorPII(java.lang.String tag, com.microsoft.identity.client.RequestContext requestContext, java.lang.String errorMessage, java.lang.Throwable exception)
com.microsoft.identity.common.internal.logging.Logger#errorPII(String, String, String, Throwable)
instead.Logger.LogLevel.ERROR
log message with PII.@Deprecated public static void warning(java.lang.String tag, com.microsoft.identity.client.RequestContext requestContext, java.lang.String message)
com.microsoft.identity.common.internal.logging.Logger#warn(String, String, String)
instead.Logger.LogLevel.WARNING
log message without PII.@Deprecated public static void warningPII(java.lang.String tag, com.microsoft.identity.client.RequestContext requestContext, java.lang.String message)
com.microsoft.identity.common.internal.logging.Logger#warnPII(String, String, String)
instead.Logger.LogLevel.WARNING
log message with PII.