Class LogService

  • All Implemented Interfaces:

    @Deprecated() 
    public class LogService
    extends MobileService
                        

    Log service is responsible for initializing logging facility.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
      LogService()
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      static LogService getInstance()
      void init(@NonNull() Application application, @Nullable() String apiKey) Initializes the mobile service
      void onStateChange(@NonNull() ApplicationState state) Notified when application state changes.
      void enableNetworkPolicy(@Nullable() NetworkPolicy policy) Enable and set network policy for mobile service.
      LogService setAutoUpload(boolean autoUploadEnabled) Specifies whether auto upload will be used.
      LogService setLogPolicy(@NonNull() LogPolicy logPolicy) Sets logging configurations by LogPolicy.
      LogService setLogConfiguration(@Nullable() Logging.ConfigurationBuilder builder) Sets logging configurations by Logging.ConfigurationBuilder.
      void reset() Resets the mobile service to the state that just initialized.
      static boolean isInitialized() Returns whether the logger has been initialized, and it has not been reset since then.
      • Methods inherited from class com.sap.cloud.mobile.foundation.mobileservices.MobileService

        getApiKey, getApplication, isApplicationInitialized, mayStartNewProcess, setApiKey, setApplication
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LogService

        LogService()
    • Method Detail

      • init

         void init(@NonNull() Application application, @Nullable() String apiKey)

        Initializes the mobile service

      • onStateChange

         void onStateChange(@NonNull() ApplicationState state)

        Notified when application state changes. This function will be called on Main thread.

      • setAutoUpload

        @NonNull() LogService setAutoUpload(boolean autoUploadEnabled)

        Specifies whether auto upload will be used.

        Parameters:
        autoUploadEnabled - true to use auto upload, false otherwise.
      • setLogPolicy

        @NonNull() LogService setLogPolicy(@NonNull() LogPolicy logPolicy)

        Sets logging configurations by LogPolicy.

        Parameters:
        logPolicy - log policy from server or user defined
        Returns:

        the log service

      • setLogConfiguration

        @NonNull() LogService setLogConfiguration(@Nullable() Logging.ConfigurationBuilder builder)

        Sets logging configurations by Logging.ConfigurationBuilder. If LogService is initialized by application context, then configs the logging. Otherwise, saves the configuration builder object and configs the logging later.

        Parameters:
        builder - configuration builder to set logging configurations
        Returns:

        the log service

      • reset

         void reset()

        Resets the mobile service to the state that just initialized.

      • isInitialized

         static boolean isInitialized()

        Returns whether the logger has been initialized, and it has not been reset since then.