cidaas-logger-ui-sdk 19.1.0 → 20.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/cidaas-logger-ui-sdk.mjs +14 -16
- package/fesm2022/cidaas-logger-ui-sdk.mjs.map +1 -1
- package/index.d.ts +92 -5
- package/package.json +2 -3
- package/lib/cidaas-logger-ui-sdk.module.d.ts +0 -12
- package/lib/model/ILoggerOptions.d.ts +0 -12
- package/lib/model/LogLevel.enum.d.ts +0 -15
- package/lib/model/LogMonitoringType.enum.d.ts +0 -5
- package/lib/model/index.d.ts +0 -3
- package/lib/services/index.d.ts +0 -2
- package/lib/services/logger.service.d.ts +0 -16
- package/lib/services/sentry-error-handler.model.d.ts +0 -16
- package/lib/services/sentry-error-handler.service.d.ts +0 -29
- package/public-api.d.ts +0 -3
|
@@ -111,15 +111,13 @@ class SentryErrorHandlerService {
|
|
|
111
111
|
tracesSampleRate: 1.0
|
|
112
112
|
}); }
|
|
113
113
|
static { this.getAdvancedMonitoringOptions = (options) => ({
|
|
114
|
-
integrations: () =>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
];
|
|
122
|
-
},
|
|
114
|
+
integrations: () => [
|
|
115
|
+
Sentry.replayIntegration(),
|
|
116
|
+
Sentry.browserTracingIntegration(),
|
|
117
|
+
Sentry.captureConsoleIntegration({
|
|
118
|
+
levels: getCaptureLogLevels(options.logLevel),
|
|
119
|
+
}),
|
|
120
|
+
],
|
|
123
121
|
replaysSessionSampleRate: 0.1,
|
|
124
122
|
replaysOnErrorSampleRate: 1.0,
|
|
125
123
|
}); }
|
|
@@ -177,10 +175,10 @@ class LoggerService {
|
|
|
177
175
|
}
|
|
178
176
|
}
|
|
179
177
|
}
|
|
180
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
181
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
178
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LoggerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
179
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LoggerService, providedIn: 'root' }); }
|
|
182
180
|
}
|
|
183
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
181
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: LoggerService, decorators: [{
|
|
184
182
|
type: Injectable,
|
|
185
183
|
args: [{
|
|
186
184
|
providedIn: 'root'
|
|
@@ -203,11 +201,11 @@ class CidaasLoggerUiSdkModule {
|
|
|
203
201
|
]
|
|
204
202
|
};
|
|
205
203
|
}
|
|
206
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
207
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
208
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
204
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CidaasLoggerUiSdkModule, deps: [{ token: CidaasLoggerUiSdkModule, optional: true, skipSelf: true }], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
205
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.3", ngImport: i0, type: CidaasLoggerUiSdkModule, imports: [BrowserModule] }); }
|
|
206
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CidaasLoggerUiSdkModule, providers: [provideHttpClient(withInterceptorsFromDi())], imports: [BrowserModule] }); }
|
|
209
207
|
}
|
|
210
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
208
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: CidaasLoggerUiSdkModule, decorators: [{
|
|
211
209
|
type: NgModule,
|
|
212
210
|
args: [{ imports: [BrowserModule], providers: [provideHttpClient(withInterceptorsFromDi())] }]
|
|
213
211
|
}], ctorParameters: () => [{ type: CidaasLoggerUiSdkModule, decorators: [{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cidaas-logger-ui-sdk.mjs","sources":["../../../projects/cidaas-logger-ui-sdk/src/lib/model/LogLevel.enum.ts","../../../projects/cidaas-logger-ui-sdk/src/lib/services/sentry-error-handler.model.ts","../../../projects/cidaas-logger-ui-sdk/src/lib/services/sentry-error-handler.service.ts","../../../projects/cidaas-logger-ui-sdk/src/lib/services/logger.service.ts","../../../projects/cidaas-logger-ui-sdk/src/lib/cidaas-logger-ui-sdk.module.ts","../../../projects/cidaas-logger-ui-sdk/src/public-api.ts","../../../projects/cidaas-logger-ui-sdk/src/cidaas-logger-ui-sdk.ts"],"sourcesContent":["export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';\nexport type LogLevelValue = 0 | 1 | 2 | 3 | 4;\n\n\nexport class LogLevelInfo {\n\n public static TRACE = new LogLevelInfo('trace', 0);\n public static DEBUG = new LogLevelInfo('debug', 1);\n public static INFO = new LogLevelInfo('info', 2);\n public static WARN = new LogLevelInfo('warn', 3);\n public static ERROR = new LogLevelInfo('error', 4);\n\n\n static levels = [LogLevelInfo.TRACE, LogLevelInfo.DEBUG, LogLevelInfo.INFO, LogLevelInfo.WARN, LogLevelInfo.ERROR];\n\n constructor(id: LogLevel, value: LogLevelValue) {\n this.id = id;\n this.value = value;\n }\n\n static of = (logLevelId: LogLevel): LogLevelInfo => {\n const level = LogLevelInfo.levels\n .find(l => l.id === logLevelId);\n if (!level) {\n throw new Error(`unknown loglevel passed: ${logLevelId}`)\n }\n return level;\n }\n\n static getLevels = (logLevelId: LogLevel): LogLevelInfo[] => {\n const level = LogLevelInfo.of(logLevelId);\n return LogLevelInfo.levels.slice(level.value, LogLevelInfo.levels.length);\n}\n\n\n readonly id: LogLevel;\n readonly value: LogLevelValue;\n\n}\n","import { LogLevel, LogLevelInfo, LogMonitoringType } from '../model';\nimport * as Sentry from '@sentry/angular';\n\n/**\n * Domain Helpers\n * */\nexport const createRelease = (options: { appName: string, version: string }) =>\n `${options.appName}@${options.version}`;\n\n\nexport const isAdvancedMonitoringEnabled = (monitoringType?: LogMonitoringType) =>\n monitoringType === LogMonitoringType.ADVANCED\n\nexport const getAppLogLevel = (logLevel?: LogLevel): LogLevel => logLevel || LogLevelInfo.WARN.id\n\n/**\n * Sentry Helpers\n * */\n\n\nexport const mapLogLevelToSentrySeverity = (logLevel?: LogLevel): Sentry.SeverityLevel => {\n logLevel = getAppLogLevel(logLevel);\n switch (logLevel) {\n case 'trace':\n case 'debug':\n return 'debug';\n case 'error':\n return 'error';\n case 'info':\n return 'info';\n case 'warn':\n return 'warning';\n }\n}\n\n\nexport const getCaptureLogLevels = (logLevel: LogLevel | undefined) => {\n logLevel = getAppLogLevel(logLevel);\n return LogLevelInfo.getLevels(logLevel).map(l =>\n mapLogLevelToSentrySeverity(l.id));\n};\n","import { ErrorHandler, Provider } from '@angular/core';\n\nimport { LoggerConfig, LogLevelInfo, LogLevel, LogMonitoringType } from '../model';\nimport { Router } from '@angular/router';\nimport {\n createRelease,\n getAppLogLevel, getCaptureLogLevels,\n isAdvancedMonitoringEnabled,\n mapLogLevelToSentrySeverity\n} from './sentry-error-handler.model';\nimport * as Sentry from '@sentry/angular';\n\nexport class SentryErrorHandlerService {\n\n private static logLevel: LogLevel | undefined;\n\n\n constructor() {\n }\n\n\n static initSentry = (sentryConfig: LoggerConfig): void => {\n\n if (!sentryConfig || !sentryConfig.dsn || sentryConfig.monitoringType === LogMonitoringType.OFF) {\n return;\n }\n\n const commonOptions = this.getCommonOptions(sentryConfig);\n const defaultOptions = this.getDefaultOptions(sentryConfig);\n SentryErrorHandlerService.logLevel = defaultOptions.logLevel;\n const simpleMonitoringOptions =\n SentryErrorHandlerService.getSimpleMonitoringOptions(defaultOptions);\n\n switch (defaultOptions.monitoringType.toString()) {\n case LogMonitoringType.SIMPLE:\n Sentry.init({\n ...commonOptions,\n ...simpleMonitoringOptions,\n defaultIntegrations: false,\n });\n\n break;\n case LogMonitoringType.ADVANCED:\n\n const advancedMonitoringOptions = SentryErrorHandlerService.getAdvancedMonitoringOptions(defaultOptions);\n Sentry.init({\n ...commonOptions,\n ...simpleMonitoringOptions,\n ...advancedMonitoringOptions,\n });\n break;\n case LogMonitoringType.OFF:\n return;\n }\n }\n\n\n static getAppLogLevel(): LogLevelInfo {\n return LogLevelInfo.of(SentryErrorHandlerService.logLevel || 'warn');\n }\n\n static getCommonOptions = (options: LoggerConfig) => ({\n dsn: options.dsn,\n release: createRelease(options)\n });\n\n\n\n static getDefaultOptions = (options: LoggerConfig) => ({\n monitoringType: options.monitoringType || LogMonitoringType.SIMPLE,\n logLevel: getAppLogLevel(options.logLevel),\n dsn: options.dsn,\n appName: options.appName,\n version: options.version\n });\n\n static getSimpleMonitoringOptions = (options: LoggerConfig) => ({\n 'initialScope': (scope: any) => {\n scope.setLevel(\n mapLogLevelToSentrySeverity(options.logLevel)\n );\n return scope;\n },\n tracesSampleRate: 1.0\n });\n\n static getAdvancedMonitoringOptions = (options: LoggerConfig) => ({\n integrations: () => {\n return [\n Sentry.replayIntegration(),\n Sentry.browserTracingIntegration(),\n Sentry.captureConsoleIntegration({\n levels: getCaptureLogLevels(options.logLevel)\n })\n ];\n },\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1.0,\n });\n\n\n\n static getSentryProviders(monitoringType?: LogMonitoringType): Provider[] {\n if (!isAdvancedMonitoringEnabled(monitoringType)) {\n return [];\n }\n\n return [\n {\n provide: ErrorHandler, useValue: Sentry.createErrorHandler({ showDialog: false })\n },\n { provide: Sentry.TraceService, deps: [Router] }\n ]\n }\n}\n","import { Injectable } from \"@angular/core\";\nimport { LogLevelInfo, LogLevelValue } from \"../model\";\nimport { SentryErrorHandlerService } from \"./sentry-error-handler.service\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LoggerService {\n\n appLogLevel: LogLevelInfo = SentryErrorHandlerService.getAppLogLevel();\n\n public logDebug(...message: any): void {\n this.writeToLog(LogLevelInfo.DEBUG.value, ...message);\n }\n\n public log(...message: any) {\n this.writeToLog(LogLevelInfo.INFO.value, ...message);\n }\n\n public logWarn(...message: any) {\n this.writeToLog(LogLevelInfo.WARN.value, ...message);\n }\n\n public logError(...message: any) {\n this.writeToLog(LogLevelInfo.ERROR.value, ...message);\n }\n\n public logTrace(...message: any) {\n this.writeToLog(LogLevelInfo.TRACE.value, ...message);\n }\n\n /**\n * Write logs.\n */\n private writeToLog(level: LogLevelValue, ...message: any) {\n if (level >= this.appLogLevel.value) {\n if (level === LogLevelInfo.INFO.value) {\n console.info(...message);\n } else if (level === LogLevelInfo.ERROR.value) {\n console.error(...message);\n } else if (level === LogLevelInfo.WARN.value) {\n console.warn(...message);\n } else if (level === LogLevelInfo.TRACE.value) {\n console.trace(...message);\n }else if (level === LogLevelInfo.DEBUG.value) {\n console.debug(...message);\n }\n }\n }\n\n}\n","import { InjectionToken, ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';\nimport { SentryErrorHandlerService } from './services';\nimport { ILoggerOptions } from './model';\n\nexport const LOGGER_CONFIG = new InjectionToken<ILoggerOptions>('LOGGER_CONFIG_PARAMS');\n\n\n@NgModule({ imports: [BrowserModule], providers: [provideHttpClient(withInterceptorsFromDi())] })\nexport class CidaasLoggerUiSdkModule {\n\n constructor(@Optional() @SkipSelf() parentModule: CidaasLoggerUiSdkModule){\n if(parentModule){\n throw new Error('CidaasLoggerUiSdkModule is already loaded. Please add it in AppModule only.');\n }\n }\n\n static forRoot(conf?: ILoggerOptions): ModuleWithProviders<CidaasLoggerUiSdkModule> {\n return {\n ngModule: CidaasLoggerUiSdkModule,\n providers: [\n {provide: LOGGER_CONFIG, useValue: conf} ,\n ...SentryErrorHandlerService.getSentryProviders(conf?.monitoringType)\n ]\n }\n }\n\n}\n","/*\n * Public API Surface of cidaas-logger-ui-sdk\n */\n\nexport * from './lib/cidaas-logger-ui-sdk.module';\n\n//enum\nexport * from './lib/model/index'\n\n// Services\nexport * from './lib/services/index';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAIa,YAAY,CAAA;aAET,IAAK,CAAA,KAAA,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aACrC,IAAK,CAAA,KAAA,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aACrC,IAAI,CAAA,IAAA,GAAG,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;aACnC,IAAI,CAAA,IAAA,GAAG,IAAI,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;aACnC,IAAK,CAAA,KAAA,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aAG5C,IAAM,CAAA,MAAA,GAAG,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAEnH,WAAY,CAAA,EAAY,EAAE,KAAoB,EAAA;AAC5C,QAAA,IAAI,CAAC,EAAE,GAAG,EAAE;AACZ,QAAA,IAAI,CAAC,KAAK,GAAG,KAAK;;AAGb,IAAA,SAAA,IAAA,CAAA,EAAE,GAAG,CAAC,UAAoB,KAAkB;AACjD,QAAA,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Aa,EAAE,QAAQ,EAAE,IAAI,EAAC;AACxC,gBAAA,GAAG,yBAAyB,CAAC,kBAAkB,CAAC,IAAI,EAAE,cAAc;AACrE;SACF;;+GAfQ,uBAAuB,EAAA,IAAA,EAAA,CAAA,EAAA,KAAA,EAAA,uBAAA,EAAA,QAAA,EAAA,IAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAvB,IAAA,SAAA,IAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,SAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YADd,aAAa,CAAA,EAAA,CAAA,CAAA;gHACtB,uBAAuB,EAAA,SAAA,EADa,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAA,OAAA,EAAA,CAAxE,aAAa,CAAA,EAAA,CAAA,CAAA;;4FACtB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA,EAAE,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE;;0BAGjF;;0BAAY;;;ACZ3B;;AAEG;;ACFH;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"cidaas-logger-ui-sdk.mjs","sources":["../../../projects/cidaas-logger-ui-sdk/src/lib/model/LogLevel.enum.ts","../../../projects/cidaas-logger-ui-sdk/src/lib/services/sentry-error-handler.model.ts","../../../projects/cidaas-logger-ui-sdk/src/lib/services/sentry-error-handler.service.ts","../../../projects/cidaas-logger-ui-sdk/src/lib/services/logger.service.ts","../../../projects/cidaas-logger-ui-sdk/src/lib/cidaas-logger-ui-sdk.module.ts","../../../projects/cidaas-logger-ui-sdk/src/public-api.ts","../../../projects/cidaas-logger-ui-sdk/src/cidaas-logger-ui-sdk.ts"],"sourcesContent":["export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';\nexport type LogLevelValue = 0 | 1 | 2 | 3 | 4;\n\n\nexport class LogLevelInfo {\n\n public static TRACE = new LogLevelInfo('trace', 0);\n public static DEBUG = new LogLevelInfo('debug', 1);\n public static INFO = new LogLevelInfo('info', 2);\n public static WARN = new LogLevelInfo('warn', 3);\n public static ERROR = new LogLevelInfo('error', 4);\n\n\n static levels = [LogLevelInfo.TRACE, LogLevelInfo.DEBUG, LogLevelInfo.INFO, LogLevelInfo.WARN, LogLevelInfo.ERROR];\n\n constructor(id: LogLevel, value: LogLevelValue) {\n this.id = id;\n this.value = value;\n }\n\n static of = (logLevelId: LogLevel): LogLevelInfo => {\n const level = LogLevelInfo.levels\n .find(l => l.id === logLevelId);\n if (!level) {\n throw new Error(`unknown loglevel passed: ${logLevelId}`)\n }\n return level;\n }\n\n static getLevels = (logLevelId: LogLevel): LogLevelInfo[] => {\n const level = LogLevelInfo.of(logLevelId);\n return LogLevelInfo.levels.slice(level.value, LogLevelInfo.levels.length);\n}\n\n\n readonly id: LogLevel;\n readonly value: LogLevelValue;\n\n}\n","import { LogLevel, LogLevelInfo, LogMonitoringType } from '../model';\nimport * as Sentry from '@sentry/angular';\n\n/**\n * Domain Helpers\n * */\nexport const createRelease = (options: { appName: string, version: string }) =>\n `${options.appName}@${options.version}`;\n\n\nexport const isAdvancedMonitoringEnabled = (monitoringType?: LogMonitoringType) =>\n monitoringType === LogMonitoringType.ADVANCED\n\nexport const getAppLogLevel = (logLevel?: LogLevel): LogLevel => logLevel || LogLevelInfo.WARN.id\n\n/**\n * Sentry Helpers\n * */\n\n\nexport const mapLogLevelToSentrySeverity = (logLevel?: LogLevel): Sentry.SeverityLevel => {\n logLevel = getAppLogLevel(logLevel);\n switch (logLevel) {\n case 'trace':\n case 'debug':\n return 'debug';\n case 'error':\n return 'error';\n case 'info':\n return 'info';\n case 'warn':\n return 'warning';\n }\n}\n\n\nexport const getCaptureLogLevels = (logLevel: LogLevel | undefined) => {\n logLevel = getAppLogLevel(logLevel);\n return LogLevelInfo.getLevels(logLevel).map(l =>\n mapLogLevelToSentrySeverity(l.id));\n};\n","import { ErrorHandler, Provider } from '@angular/core';\n\nimport { LoggerConfig, LogLevelInfo, LogLevel, LogMonitoringType } from '../model';\nimport { Router } from '@angular/router';\nimport {\n createRelease,\n getAppLogLevel, getCaptureLogLevels,\n isAdvancedMonitoringEnabled,\n mapLogLevelToSentrySeverity\n} from './sentry-error-handler.model';\nimport * as Sentry from '@sentry/angular';\nimport { Integration } from '@sentry/types';\n\nexport class SentryErrorHandlerService {\n\n private static logLevel: LogLevel | undefined;\n\n\n constructor() {\n }\n\n\n static initSentry = (sentryConfig: LoggerConfig): void => {\n\n if (!sentryConfig || !sentryConfig.dsn || sentryConfig.monitoringType === LogMonitoringType.OFF) {\n return;\n }\n\n const commonOptions = this.getCommonOptions(sentryConfig);\n const defaultOptions = this.getDefaultOptions(sentryConfig);\n SentryErrorHandlerService.logLevel = defaultOptions.logLevel;\n const simpleMonitoringOptions =\n SentryErrorHandlerService.getSimpleMonitoringOptions(defaultOptions);\n\n switch (defaultOptions.monitoringType.toString()) {\n case LogMonitoringType.SIMPLE:\n Sentry.init({\n ...commonOptions,\n ...simpleMonitoringOptions,\n defaultIntegrations: false,\n });\n\n break;\n case LogMonitoringType.ADVANCED:\n\n const advancedMonitoringOptions = SentryErrorHandlerService.getAdvancedMonitoringOptions(defaultOptions);\n Sentry.init({\n ...commonOptions,\n ...simpleMonitoringOptions,\n ...advancedMonitoringOptions,\n });\n break;\n case LogMonitoringType.OFF:\n return;\n }\n }\n\n\n static getAppLogLevel(): LogLevelInfo {\n return LogLevelInfo.of(SentryErrorHandlerService.logLevel || 'warn');\n }\n\n static getCommonOptions = (options: LoggerConfig) => ({\n dsn: options.dsn,\n release: createRelease(options)\n });\n\n\n\n static getDefaultOptions = (options: LoggerConfig) => ({\n monitoringType: options.monitoringType || LogMonitoringType.SIMPLE,\n logLevel: getAppLogLevel(options.logLevel),\n dsn: options.dsn,\n appName: options.appName,\n version: options.version\n });\n\n static getSimpleMonitoringOptions = (options: LoggerConfig) => ({\n 'initialScope': (scope: any) => {\n scope.setLevel(\n mapLogLevelToSentrySeverity(options.logLevel)\n );\n return scope;\n },\n tracesSampleRate: 1.0\n });\n\n static getAdvancedMonitoringOptions = (\n options: LoggerConfig\n): {\n integrations: () => Integration[];\n replaysSessionSampleRate: number;\n replaysOnErrorSampleRate: number;\n} => ({\n integrations: () => [\n Sentry.replayIntegration(),\n Sentry.browserTracingIntegration(),\n Sentry.captureConsoleIntegration({\n levels: getCaptureLogLevels(options.logLevel),\n }),\n ],\n replaysSessionSampleRate: 0.1,\n replaysOnErrorSampleRate: 1.0,\n});\n\n\n\n static getSentryProviders(monitoringType?: LogMonitoringType): Provider[] {\n if (!isAdvancedMonitoringEnabled(monitoringType)) {\n return [];\n }\n\n return [\n {\n provide: ErrorHandler, useValue: Sentry.createErrorHandler({ showDialog: false })\n },\n { provide: Sentry.TraceService, deps: [Router] }\n ]\n }\n}\n","import { Injectable } from \"@angular/core\";\nimport { LogLevelInfo, LogLevelValue } from \"../model\";\nimport { SentryErrorHandlerService } from \"./sentry-error-handler.service\";\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LoggerService {\n\n appLogLevel: LogLevelInfo = SentryErrorHandlerService.getAppLogLevel();\n\n public logDebug(...message: any): void {\n this.writeToLog(LogLevelInfo.DEBUG.value, ...message);\n }\n\n public log(...message: any) {\n this.writeToLog(LogLevelInfo.INFO.value, ...message);\n }\n\n public logWarn(...message: any) {\n this.writeToLog(LogLevelInfo.WARN.value, ...message);\n }\n\n public logError(...message: any) {\n this.writeToLog(LogLevelInfo.ERROR.value, ...message);\n }\n\n public logTrace(...message: any) {\n this.writeToLog(LogLevelInfo.TRACE.value, ...message);\n }\n\n /**\n * Write logs.\n */\n private writeToLog(level: LogLevelValue, ...message: any) {\n if (level >= this.appLogLevel.value) {\n if (level === LogLevelInfo.INFO.value) {\n console.info(...message);\n } else if (level === LogLevelInfo.ERROR.value) {\n console.error(...message);\n } else if (level === LogLevelInfo.WARN.value) {\n console.warn(...message);\n } else if (level === LogLevelInfo.TRACE.value) {\n console.trace(...message);\n }else if (level === LogLevelInfo.DEBUG.value) {\n console.debug(...message);\n }\n }\n }\n\n}\n","import { InjectionToken, ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';\nimport { BrowserModule } from '@angular/platform-browser';\nimport { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';\nimport { SentryErrorHandlerService } from './services';\nimport { ILoggerOptions } from './model';\n\nexport const LOGGER_CONFIG = new InjectionToken<ILoggerOptions>('LOGGER_CONFIG_PARAMS');\n\n\n@NgModule({ imports: [BrowserModule], providers: [provideHttpClient(withInterceptorsFromDi())] })\nexport class CidaasLoggerUiSdkModule {\n\n constructor(@Optional() @SkipSelf() parentModule: CidaasLoggerUiSdkModule){\n if(parentModule){\n throw new Error('CidaasLoggerUiSdkModule is already loaded. Please add it in AppModule only.');\n }\n }\n\n static forRoot(conf?: ILoggerOptions): ModuleWithProviders<CidaasLoggerUiSdkModule> {\n return {\n ngModule: CidaasLoggerUiSdkModule,\n providers: [\n {provide: LOGGER_CONFIG, useValue: conf} ,\n ...SentryErrorHandlerService.getSentryProviders(conf?.monitoringType)\n ]\n }\n }\n\n}\n","/*\n * Public API Surface of cidaas-logger-ui-sdk\n */\n\nexport * from './lib/cidaas-logger-ui-sdk.module';\n\n//enum\nexport * from './lib/model/index'\n\n// Services\nexport * from './lib/services/index';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;MAIa,YAAY,CAAA;aAET,IAAA,CAAA,KAAK,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aACrC,IAAA,CAAA,KAAK,GAAG,IAAI,YAAY,CAAC,OAAO,EA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E,aAAa,CAAA,EAAA,CAAA,CAAA;;2FACtB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBADnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA,EAAE,OAAO,EAAE,CAAC,aAAa,CAAC,EAAE,SAAS,EAAE,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,CAAC,EAAE;;0BAGjF;;0BAAY;;;ACZ3B;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,5 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, ModuleWithProviders, Provider } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/platform-browser';
|
|
4
|
+
import { Integration } from '@sentry/types';
|
|
5
|
+
|
|
6
|
+
type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
|
|
7
|
+
type LogLevelValue = 0 | 1 | 2 | 3 | 4;
|
|
8
|
+
declare class LogLevelInfo {
|
|
9
|
+
static TRACE: LogLevelInfo;
|
|
10
|
+
static DEBUG: LogLevelInfo;
|
|
11
|
+
static INFO: LogLevelInfo;
|
|
12
|
+
static WARN: LogLevelInfo;
|
|
13
|
+
static ERROR: LogLevelInfo;
|
|
14
|
+
static levels: LogLevelInfo[];
|
|
15
|
+
constructor(id: LogLevel, value: LogLevelValue);
|
|
16
|
+
static of: (logLevelId: LogLevel) => LogLevelInfo;
|
|
17
|
+
static getLevels: (logLevelId: LogLevel) => LogLevelInfo[];
|
|
18
|
+
readonly id: LogLevel;
|
|
19
|
+
readonly value: LogLevelValue;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare const enum LogMonitoringType {
|
|
23
|
+
SIMPLE = "SIMPLE",
|
|
24
|
+
ADVANCED = "ADVANCED",
|
|
25
|
+
OFF = "OFF"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface ILoggerOptions {
|
|
29
|
+
appName: string;
|
|
30
|
+
version: string;
|
|
31
|
+
logLevel?: LogLevel;
|
|
32
|
+
monitoringType?: LogMonitoringType;
|
|
33
|
+
}
|
|
34
|
+
interface ISentryOptions {
|
|
35
|
+
dsn: string;
|
|
36
|
+
}
|
|
37
|
+
type LoggerConfig = ILoggerOptions & ISentryOptions;
|
|
38
|
+
|
|
39
|
+
declare const LOGGER_CONFIG: InjectionToken<ILoggerOptions>;
|
|
40
|
+
declare class CidaasLoggerUiSdkModule {
|
|
41
|
+
constructor(parentModule: CidaasLoggerUiSdkModule);
|
|
42
|
+
static forRoot(conf?: ILoggerOptions): ModuleWithProviders<CidaasLoggerUiSdkModule>;
|
|
43
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<CidaasLoggerUiSdkModule, [{ optional: true; skipSelf: true; }]>;
|
|
44
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<CidaasLoggerUiSdkModule, never, [typeof i1.BrowserModule], never>;
|
|
45
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<CidaasLoggerUiSdkModule>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
declare class SentryErrorHandlerService {
|
|
49
|
+
private static logLevel;
|
|
50
|
+
constructor();
|
|
51
|
+
static initSentry: (sentryConfig: LoggerConfig) => void;
|
|
52
|
+
static getAppLogLevel(): LogLevelInfo;
|
|
53
|
+
static getCommonOptions: (options: LoggerConfig) => {
|
|
54
|
+
dsn: string;
|
|
55
|
+
release: string;
|
|
56
|
+
};
|
|
57
|
+
static getDefaultOptions: (options: LoggerConfig) => {
|
|
58
|
+
monitoringType: LogMonitoringType;
|
|
59
|
+
logLevel: LogLevel;
|
|
60
|
+
dsn: string;
|
|
61
|
+
appName: string;
|
|
62
|
+
version: string;
|
|
63
|
+
};
|
|
64
|
+
static getSimpleMonitoringOptions: (options: LoggerConfig) => {
|
|
65
|
+
initialScope: (scope: any) => any;
|
|
66
|
+
tracesSampleRate: number;
|
|
67
|
+
};
|
|
68
|
+
static getAdvancedMonitoringOptions: (options: LoggerConfig) => {
|
|
69
|
+
integrations: () => Integration[];
|
|
70
|
+
replaysSessionSampleRate: number;
|
|
71
|
+
replaysOnErrorSampleRate: number;
|
|
72
|
+
};
|
|
73
|
+
static getSentryProviders(monitoringType?: LogMonitoringType): Provider[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
declare class LoggerService {
|
|
77
|
+
appLogLevel: LogLevelInfo;
|
|
78
|
+
logDebug(...message: any): void;
|
|
79
|
+
log(...message: any): void;
|
|
80
|
+
logWarn(...message: any): void;
|
|
81
|
+
logError(...message: any): void;
|
|
82
|
+
logTrace(...message: any): void;
|
|
83
|
+
/**
|
|
84
|
+
* Write logs.
|
|
85
|
+
*/
|
|
86
|
+
private writeToLog;
|
|
87
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<LoggerService, never>;
|
|
88
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<LoggerService>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export { CidaasLoggerUiSdkModule, LOGGER_CONFIG, LogLevelInfo, LogMonitoringType, LoggerService, SentryErrorHandlerService };
|
|
92
|
+
export type { ILoggerOptions, ISentryOptions, LogLevel, LogLevelValue, LoggerConfig };
|
package/package.json
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cidaas-logger-ui-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.1",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^19.0.0",
|
|
6
6
|
"@angular/core": "^19.0.0",
|
|
7
|
-
"@sentry/angular
|
|
8
|
-
"@sentry/integrations": "7.83.0"
|
|
7
|
+
"@sentry/angular": "^8.0.0"
|
|
9
8
|
},
|
|
10
9
|
"dependencies": {
|
|
11
10
|
"tslib": "^2.3.0"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, ModuleWithProviders } from '@angular/core';
|
|
2
|
-
import { ILoggerOptions } from './model';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
import * as i1 from "@angular/platform-browser";
|
|
5
|
-
export declare const LOGGER_CONFIG: InjectionToken<ILoggerOptions>;
|
|
6
|
-
export declare class CidaasLoggerUiSdkModule {
|
|
7
|
-
constructor(parentModule: CidaasLoggerUiSdkModule);
|
|
8
|
-
static forRoot(conf?: ILoggerOptions): ModuleWithProviders<CidaasLoggerUiSdkModule>;
|
|
9
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<CidaasLoggerUiSdkModule, [{ optional: true; skipSelf: true; }]>;
|
|
10
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<CidaasLoggerUiSdkModule, never, [typeof i1.BrowserModule], never>;
|
|
11
|
-
static ɵinj: i0.ɵɵInjectorDeclaration<CidaasLoggerUiSdkModule>;
|
|
12
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LogLevel } from "./LogLevel.enum";
|
|
2
|
-
import { LogMonitoringType } from "./LogMonitoringType.enum";
|
|
3
|
-
export interface ILoggerOptions {
|
|
4
|
-
appName: string;
|
|
5
|
-
version: string;
|
|
6
|
-
logLevel?: LogLevel;
|
|
7
|
-
monitoringType?: LogMonitoringType;
|
|
8
|
-
}
|
|
9
|
-
export interface ISentryOptions {
|
|
10
|
-
dsn: string;
|
|
11
|
-
}
|
|
12
|
-
export type LoggerConfig = ILoggerOptions & ISentryOptions;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
-
export type LogLevelValue = 0 | 1 | 2 | 3 | 4;
|
|
3
|
-
export declare class LogLevelInfo {
|
|
4
|
-
static TRACE: LogLevelInfo;
|
|
5
|
-
static DEBUG: LogLevelInfo;
|
|
6
|
-
static INFO: LogLevelInfo;
|
|
7
|
-
static WARN: LogLevelInfo;
|
|
8
|
-
static ERROR: LogLevelInfo;
|
|
9
|
-
static levels: LogLevelInfo[];
|
|
10
|
-
constructor(id: LogLevel, value: LogLevelValue);
|
|
11
|
-
static of: (logLevelId: LogLevel) => LogLevelInfo;
|
|
12
|
-
static getLevels: (logLevelId: LogLevel) => LogLevelInfo[];
|
|
13
|
-
readonly id: LogLevel;
|
|
14
|
-
readonly value: LogLevelValue;
|
|
15
|
-
}
|
package/lib/model/index.d.ts
DELETED
package/lib/services/index.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { LogLevelInfo } from "../model";
|
|
2
|
-
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class LoggerService {
|
|
4
|
-
appLogLevel: LogLevelInfo;
|
|
5
|
-
logDebug(...message: any): void;
|
|
6
|
-
log(...message: any): void;
|
|
7
|
-
logWarn(...message: any): void;
|
|
8
|
-
logError(...message: any): void;
|
|
9
|
-
logTrace(...message: any): void;
|
|
10
|
-
/**
|
|
11
|
-
* Write logs.
|
|
12
|
-
*/
|
|
13
|
-
private writeToLog;
|
|
14
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<LoggerService, never>;
|
|
15
|
-
static ɵprov: i0.ɵɵInjectableDeclaration<LoggerService>;
|
|
16
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { LogLevel, LogMonitoringType } from '../model';
|
|
2
|
-
import * as Sentry from '@sentry/angular';
|
|
3
|
-
/**
|
|
4
|
-
* Domain Helpers
|
|
5
|
-
* */
|
|
6
|
-
export declare const createRelease: (options: {
|
|
7
|
-
appName: string;
|
|
8
|
-
version: string;
|
|
9
|
-
}) => string;
|
|
10
|
-
export declare const isAdvancedMonitoringEnabled: (monitoringType?: LogMonitoringType) => monitoringType is LogMonitoringType.ADVANCED;
|
|
11
|
-
export declare const getAppLogLevel: (logLevel?: LogLevel) => LogLevel;
|
|
12
|
-
/**
|
|
13
|
-
* Sentry Helpers
|
|
14
|
-
* */
|
|
15
|
-
export declare const mapLogLevelToSentrySeverity: (logLevel?: LogLevel) => Sentry.SeverityLevel;
|
|
16
|
-
export declare const getCaptureLogLevels: (logLevel: LogLevel | undefined) => Sentry.SeverityLevel[];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Provider } from '@angular/core';
|
|
2
|
-
import { LoggerConfig, LogLevelInfo, LogLevel, LogMonitoringType } from '../model';
|
|
3
|
-
export declare class SentryErrorHandlerService {
|
|
4
|
-
private static logLevel;
|
|
5
|
-
constructor();
|
|
6
|
-
static initSentry: (sentryConfig: LoggerConfig) => void;
|
|
7
|
-
static getAppLogLevel(): LogLevelInfo;
|
|
8
|
-
static getCommonOptions: (options: LoggerConfig) => {
|
|
9
|
-
dsn: string;
|
|
10
|
-
release: string;
|
|
11
|
-
};
|
|
12
|
-
static getDefaultOptions: (options: LoggerConfig) => {
|
|
13
|
-
monitoringType: LogMonitoringType;
|
|
14
|
-
logLevel: LogLevel;
|
|
15
|
-
dsn: string;
|
|
16
|
-
appName: string;
|
|
17
|
-
version: string;
|
|
18
|
-
};
|
|
19
|
-
static getSimpleMonitoringOptions: (options: LoggerConfig) => {
|
|
20
|
-
initialScope: (scope: any) => any;
|
|
21
|
-
tracesSampleRate: number;
|
|
22
|
-
};
|
|
23
|
-
static getAdvancedMonitoringOptions: (options: LoggerConfig) => {
|
|
24
|
-
integrations: () => (import("@sentry/core").Integration | import("@sentry-internal/replay/build/npm/types/integration").Replay)[];
|
|
25
|
-
replaysSessionSampleRate: number;
|
|
26
|
-
replaysOnErrorSampleRate: number;
|
|
27
|
-
};
|
|
28
|
-
static getSentryProviders(monitoringType?: LogMonitoringType): Provider[];
|
|
29
|
-
}
|
package/public-api.d.ts
DELETED