public void activate ( final ApiConfiguration apiConfig ) { Preconditions . checkNotNull ( apiConfig ) ; Preconditions . checkNotNull ( apiConfig . getApiUrl ( ) ) ; Preconditions . checkArgument ( ! apiConfig . getApiUrl ( ) . isEmpty ( ) ) ; Preconditions . checkNotNull ( apiConfig . getApiKey ( ) ) ; Preconditions . checkArgument ( ! apiConfig . getApiKey ( ) . isEmpty ( ) ) ; // Single JSON object mapper for all services ObjectMapper objectMapper = new ObjectMapper ( ) ; // build the app identity service AppIdentityService appIdentityService = new AppIdentityService ( apiConfig , objectMapper ) ; // build the services for collecting and sending log messages this . collector = new LogCollector ( logger , apiConfig . getEnvDetail ( ) , appIdentityService ) ; LogSender sender = new LogSender ( apiConfig , objectMapper , this . masker , this . skipJson ) ; // set allowComDotStackify if ( Boolean . TRUE . equals ( apiConfig . getAllowComDotStackify ( ) ) ) { this . allowComDotStackify = true ; } // build the background service to asynchronously post errors to Stackify // startup the background service this . backgroundService = new LogBackgroundService ( collector , sender ) ; this . backgroundService . start ( ) ; }
Activates the appender