diff --git a/packages/nativescript-appdynamics/common.ts b/packages/nativescript-appdynamics/common.ts index f611258..f46928e 100644 --- a/packages/nativescript-appdynamics/common.ts +++ b/packages/nativescript-appdynamics/common.ts @@ -5,13 +5,9 @@ interface SessionFrame { } export enum LoggingLevel { - Off = 0, - Error = 1, - Warn = 2, - Info = 3, - Debug = 4, - Verbose = 5, - All = 6, + None = 0, + Info = 1, + Verbose = 2, } // you can find the relevant URLs at https://docs.appdynamics.com/paa/saas-domains-and-ip-ranges diff --git a/packages/nativescript-appdynamics/index.android.ts b/packages/nativescript-appdynamics/index.android.ts index 1e872d5..9b321eb 100644 --- a/packages/nativescript-appdynamics/index.android.ts +++ b/packages/nativescript-appdynamics/index.android.ts @@ -1,20 +1,26 @@ import { HttpErrorResponse } from '@angular/common/http'; import { Utils } from '@nativescript/core'; -import { AppdynamicsConfiguration, IAppdynamics, LoggingLevel, IRequestTracker } from './common'; import lazy from '@nativescript/core/utils/lazy'; +import { AppdynamicsConfiguration, IAppdynamics, IRequestTracker, LoggingLevel } from './common'; const Instrumentation = lazy(() => com.appdynamics.eumagent.runtime.Instrumentation); // https://docs.appdynamics.com/appd/21.x/21.9/en/end-user-monitoring/mobile-real-user-monitoring/instrument-android-applications export class Appdynamics implements IAppdynamics { + private logLevelMapper = { + [LoggingLevel.None]: com.appdynamics.eumagent.runtime.Instrumentation.LOGGING_LEVEL_NONE, + [LoggingLevel.Info]: com.appdynamics.eumagent.runtime.Instrumentation.LOGGING_LEVEL_INFO, + [LoggingLevel.Verbose]: com.appdynamics.eumagent.runtime.Instrumentation.LOGGING_LEVEL_VERBOSE, + }; + public init(config: AppdynamicsConfiguration) { const instrumentationConfig = com.appdynamics.eumagent.runtime.AgentConfiguration.builder() .withAppKey(config.appKey) .withContext(Utils.android.getApplicationContext()) .withCollectorURL(config.collectorURL) .withScreenshotURL(config.screenshotURL) - .withLoggingLevel(config.loggingLevel || LoggingLevel.Off) + .withLoggingLevel(this.logLevelMapper[config.loggingLevel || LoggingLevel.None]) .withApplicationName(config.applicationName) .withJSAgentAjaxEnabled(config.jsAgentAjaxEnabled) .withJSAgentInjectionEnabled(config.jsAgentInjectionEnabled) diff --git a/packages/nativescript-appdynamics/index.ios.ts b/packages/nativescript-appdynamics/index.ios.ts index 7dee48c..098ddf5 100644 --- a/packages/nativescript-appdynamics/index.ios.ts +++ b/packages/nativescript-appdynamics/index.ios.ts @@ -1,14 +1,20 @@ import { HttpErrorResponse } from '@angular/common/http'; -import { AppdynamicsConfiguration, IAppdynamics, LoggingLevel, IRequestTracker } from './common'; +import { AppdynamicsConfiguration, IAppdynamics, IRequestTracker, LoggingLevel } from './common'; // https://docs.appdynamics.com/appd/21.x/21.9/en/end-user-monitoring/mobile-real-user-monitoring/instrument-ios-applications/customize-the-ios-instrumentation export class Appdynamics implements IAppdynamics { + private logLevelMapper = { + [LoggingLevel.None]: ADEumLoggingLevel.Off, + [LoggingLevel.Info]: ADEumLoggingLevel.Info, + [LoggingLevel.Verbose]: ADEumLoggingLevel.Verbose, + }; + public init(config: AppdynamicsConfiguration) { const adeumConfig = ADEumAgentConfiguration.alloc().initWithAppKey(config.appKey); adeumConfig.collectorURL = config.collectorURL; adeumConfig.screenshotURL = config.screenshotURL; - adeumConfig.loggingLevel = (config.loggingLevel || LoggingLevel.Off) as unknown as ADEumLoggingLevel; + adeumConfig.loggingLevel = this.logLevelMapper[config.loggingLevel || LoggingLevel.None]; adeumConfig.applicationName = config.applicationName; adeumConfig.jsAgentAjaxEnabled = config.jsAgentAjaxEnabled; adeumConfig.jsAgentEnabled = config.jsAgentInjectionEnabled; diff --git a/packages/nativescript-appdynamics/package.json b/packages/nativescript-appdynamics/package.json index 529ea4e..0368caa 100644 --- a/packages/nativescript-appdynamics/package.json +++ b/packages/nativescript-appdynamics/package.json @@ -1,6 +1,6 @@ { "name": "@essent/nativescript-appdynamics", - "version": "22.8.0", + "version": "22.8.2", "description": "Add a plugin description", "main": "index", "typings": "index.d.ts", diff --git a/tools/workspace-scripts.js b/tools/workspace-scripts.js index 079dddc..a42197d 100644 --- a/tools/workspace-scripts.js +++ b/tools/workspace-scripts.js @@ -89,6 +89,13 @@ module.exports = { description: '@essent/nativescript-adobe-experience-cloud: Build', }, }, + // @essent/nativescript-appdynamics + 'nativescript-appdynamics': { + build: { + script: 'nx run nativescript-appdynamics:build.all', + description: '@essent/nativescript-appdynamics: Build', + }, + }, // @essent/nativescript-ng-sentry 'nativescript-ng-sentry': { build: { @@ -122,6 +129,10 @@ module.exports = { script: 'nx run nativescript-adobe-experience-cloud:focus', description: 'Focus on @essent/nativescript-adobe-experience-cloud', }, + 'nativescript-appdynamics': { + script: 'nx run nativescript-appdynamics:focus', + description: 'Focus on @essent/nativescript-appdynamics', + }, 'nativescript-ng-sentry': { script: 'nx run nativescript-ng-sentry:focus', description: 'Focus on @essent/nativescript-ng-sentry',