How to use @dagonmetric/ng-log - 10 common examples

To help you get started, we’ve selected a few @dagonmetric/ng-log examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github myanmartools / Myanmar-Tools / src / app / app.module.ts View on Github external
RouterModule.forRoot(appRoutes, { scrollPositionRestoration: 'enabled' }),

        MatButtonModule,
        MatCardModule,
        MatIconModule,

        // ng-config modules
        ConfigModule.init(),
        StaticConfigLoaderModule.withSettings(appSettings),

        // ng-cache modules
        CacheModule,
        MemoryCacheModule,

        // ng-log modules
        LogModule.withConfig({
            minLevel: environment.production ? 'warn' : 'trace'
        }),
        ConsoleLoggerModule.withOptions({
            enableDebug: !environment.production
        }),
    ],
    providers: [
        {
            provide: APP_BASE_HREF,
            useFactory: baseHrefFactory,
            deps: [DOCUMENT]
        },
        LinkService,
        UrlHelper,
        {
            provide: MatIconRegistry,
github myanmartools / Myanmar-Tools / src / app / app.module.ts View on Github external
MatCardModule,
        MatIconModule,

        // ng-config modules
        ConfigModule.init(),
        StaticConfigLoaderModule.withSettings(appSettings),

        // ng-cache modules
        CacheModule,
        MemoryCacheModule,

        // ng-log modules
        LogModule.withConfig({
            minLevel: environment.production ? 'warn' : 'trace'
        }),
        ConsoleLoggerModule.withOptions({
            enableDebug: !environment.production
        }),
    ],
    providers: [
        {
            provide: APP_BASE_HREF,
            useFactory: baseHrefFactory,
            deps: [DOCUMENT]
        },
        LinkService,
        UrlHelper,
        {
            provide: MatIconRegistry,
            useClass: CustomIconRegistry
        },
        appSvgIconProviders
github myanmartools / zawgyi-unicode-converter-pwa / src / app / shared / ng-log-firebase-analytics / firebase-analytics-logger.ts View on Github external
log(logLevel: LogLevel, message: string | Error, logInfo?: LogInfo): void {
        if (!this._analytics$ || logLevel === LogLevel.None) {
            return;
        }

        // tslint:disable-next-line: no-any
        const properties: { [key: string]: any } = logInfo && logInfo.properties ? { ...logInfo.properties } : {};

        if (logLevel === LogLevel.Error || logLevel === LogLevel.Critical) {
            properties.description = typeof message === 'string' ? message : `${message}`;
            properties.fatal = logLevel === LogLevel.Critical;

            this._analytics$.pipe(
                tap((analyticsService) => {
                    analyticsService.logEvent('exception', properties);
                }),
                runOutsideAngular(this._zone)
            ).subscribe();
        } else {
            let level: string;
            if (logLevel === LogLevel.Trace) {
                level = 'trace';
            } else if (logLevel === LogLevel.Debug) {
                level = 'debug';
            } else if (logLevel === LogLevel.Info) {
github myanmartools / zawgyi-unicode-converter-pwa / src / app / shared / ng-log-firebase-analytics / firebase-analytics-logger.ts View on Github external
log(logLevel: LogLevel, message: string | Error, logInfo?: LogInfo): void {
        if (!this._analytics$ || logLevel === LogLevel.None) {
            return;
        }

        // tslint:disable-next-line: no-any
        const properties: { [key: string]: any } = logInfo && logInfo.properties ? { ...logInfo.properties } : {};

        if (logLevel === LogLevel.Error || logLevel === LogLevel.Critical) {
            properties.description = typeof message === 'string' ? message : `${message}`;
            properties.fatal = logLevel === LogLevel.Critical;

            this._analytics$.pipe(
                tap((analyticsService) => {
                    analyticsService.logEvent('exception', properties);
                }),
                runOutsideAngular(this._zone)
            ).subscribe();
        } else {
            let level: string;
            if (logLevel === LogLevel.Trace) {
                level = 'trace';
            } else if (logLevel === LogLevel.Debug) {
                level = 'debug';
            } else if (logLevel === LogLevel.Info) {
                level = 'info';
            } else {
github myanmartools / zawgyi-unicode-converter-pwa / src / modules / ng-log-firebase-analytics / firebase-analytics-logger.ts View on Github external
if (!this._analytics || logLevel === LogLevel.None) {
            return;
        }

        // tslint:disable-next-line: no-any
        const properties: { [key: string]: any } = logInfo && logInfo.properties ? { ...logInfo.properties } : {};

        if (this._userInfo.userId) {
            properties.user_id = this._userInfo.userId;
        }

        if (this._userInfo.accountId) {
            properties.account_id = this._userInfo.accountId;
        }

        if (logLevel === LogLevel.Error || logLevel === LogLevel.Critical) {
            properties.description = typeof message === 'string' ? message : `${message}`;
            properties.fatal = logLevel === LogLevel.Critical;

            this._analytics.logEvent('exception', properties);
        } else {
            let level: string;
            if (logLevel === LogLevel.Trace) {
                level = 'trace';
            } else if (logLevel === LogLevel.Debug) {
                level = 'debug';
            } else if (logLevel === LogLevel.Info) {
                level = 'info';
            } else {
                level = 'warn';
            }
github myanmartools / zawgyi-unicode-converter-pwa / src / modules / ng-log-firebase-analytics / firebase-analytics-logger.ts View on Github external
}

        // tslint:disable-next-line: no-any
        const properties: { [key: string]: any } = logInfo && logInfo.properties ? { ...logInfo.properties } : {};

        if (this._userInfo.userId) {
            properties.user_id = this._userInfo.userId;
        }

        if (this._userInfo.accountId) {
            properties.account_id = this._userInfo.accountId;
        }

        if (logLevel === LogLevel.Error || logLevel === LogLevel.Critical) {
            properties.description = typeof message === 'string' ? message : `${message}`;
            properties.fatal = logLevel === LogLevel.Critical;

            this._analytics.logEvent('exception', properties);
        } else {
            let level: string;
            if (logLevel === LogLevel.Trace) {
                level = 'trace';
            } else if (logLevel === LogLevel.Debug) {
                level = 'debug';
            } else if (logLevel === LogLevel.Info) {
                level = 'info';
            } else {
                level = 'warn';
            }

            properties.message = typeof message === 'string' ? message : `${message}`;
            properties.level = level;
github myanmartools / zawgyi-unicode-converter-pwa / src / modules / ng-log-firebase-analytics / firebase-analytics-logger.ts View on Github external
log(logLevel: LogLevel, message: string | Error, logInfo?: LogInfo): void {
        if (!this._analytics || logLevel === LogLevel.None) {
            return;
        }

        // tslint:disable-next-line: no-any
        const properties: { [key: string]: any } = logInfo && logInfo.properties ? { ...logInfo.properties } : {};

        if (this._userInfo.userId) {
            properties.user_id = this._userInfo.userId;
        }

        if (this._userInfo.accountId) {
            properties.account_id = this._userInfo.accountId;
        }

        if (logLevel === LogLevel.Error || logLevel === LogLevel.Critical) {
            properties.description = typeof message === 'string' ? message : `${message}`;
github myanmartools / zawgyi-unicode-converter-pwa / src / app / shared / ng-log-firebase-analytics / firebase-analytics-logger.ts View on Github external
log(logLevel: LogLevel, message: string | Error, logInfo?: LogInfo): void {
        if (!this._analytics$ || logLevel === LogLevel.None) {
            return;
        }

        // tslint:disable-next-line: no-any
        const properties: { [key: string]: any } = logInfo && logInfo.properties ? { ...logInfo.properties } : {};

        if (logLevel === LogLevel.Error || logLevel === LogLevel.Critical) {
            properties.description = typeof message === 'string' ? message : `${message}`;
            properties.fatal = logLevel === LogLevel.Critical;

            this._analytics$.pipe(
                tap((analyticsService) => {
                    analyticsService.logEvent('exception', properties);
                }),
                runOutsideAngular(this._zone)
            ).subscribe();
github myanmartools / zawgyi-unicode-converter-pwa / src / app / shared / ng-log-firebase-analytics / firebase-analytics-logger.ts View on Github external
// tslint:disable-next-line: no-any
        const properties: { [key: string]: any } = logInfo && logInfo.properties ? { ...logInfo.properties } : {};

        if (logLevel === LogLevel.Error || logLevel === LogLevel.Critical) {
            properties.description = typeof message === 'string' ? message : `${message}`;
            properties.fatal = logLevel === LogLevel.Critical;

            this._analytics$.pipe(
                tap((analyticsService) => {
                    analyticsService.logEvent('exception', properties);
                }),
                runOutsideAngular(this._zone)
            ).subscribe();
        } else {
            let level: string;
            if (logLevel === LogLevel.Trace) {
                level = 'trace';
            } else if (logLevel === LogLevel.Debug) {
                level = 'debug';
            } else if (logLevel === LogLevel.Info) {
                level = 'info';
            } else {
                level = 'warn';
            }

            properties.message = typeof message === 'string' ? message : `${message}`;
            properties.level = level;

            this._analytics$.pipe(
                tap((analyticsService) => {
                    analyticsService.logEvent('trace', properties);
                }),
github myanmartools / zawgyi-unicode-converter-pwa / src / app / shared / ng-log-firebase-analytics / firebase-analytics-logger.ts View on Github external
if (logLevel === LogLevel.Error || logLevel === LogLevel.Critical) {
            properties.description = typeof message === 'string' ? message : `${message}`;
            properties.fatal = logLevel === LogLevel.Critical;

            this._analytics$.pipe(
                tap((analyticsService) => {
                    analyticsService.logEvent('exception', properties);
                }),
                runOutsideAngular(this._zone)
            ).subscribe();
        } else {
            let level: string;
            if (logLevel === LogLevel.Trace) {
                level = 'trace';
            } else if (logLevel === LogLevel.Debug) {
                level = 'debug';
            } else if (logLevel === LogLevel.Info) {
                level = 'info';
            } else {
                level = 'warn';
            }

            properties.message = typeof message === 'string' ? message : `${message}`;
            properties.level = level;

            this._analytics$.pipe(
                tap((analyticsService) => {
                    analyticsService.logEvent('trace', properties);
                }),
                runOutsideAngular(this._zone)
            ).subscribe();

@dagonmetric/ng-log

Vendor-agnostic logging, analytics and telemetry service abstractions and some implementations for Angular applications.

MIT
Latest version published 4 years ago

Package Health Score

49 / 100
Full package analysis