Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@nwx/logger
Advanced tools
A simple logger module for Angular applications
npm i @nwx/logger |OR| yarn add @nwx/logger
// In your environment{prod,staging}.ts
import { AppCfg, TargetPlatform, HttpMethod } from '@nwx/cfg';
import { LogLevels } from 'pkgs/logger';
export const environment: AppCfg = {
// app name
appName: 'Neekware',
// target (browser, mobile, desktop)
target: TargetPlatform.web,
// production, staging or development
production: false,
// one or more app specific field(s)
log: {
// Log level, (default = none)
level: LogLevels.info
}
};
// In your app.module.ts
import { CfgModule } from '@nwx/cfg';
import { LoggerModule } from '@nwx/logger';
import { environment } from '../environments/environment';
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, CfgModule.forRoot(environment), LoggerModule],
bootstrap: [AppComponent]
})
export class AppModule {}
// In your app.component.ts or (some.service.ts)
import { Component } from '@angular/core';
import { CfgService } from '@nwx/cfg';
import { LoggerService } from '@nwx/logger';
@Component({
selector: 'app-root'
})
export class AppComponent {
title = 'Neekware';
options = {};
constructor(public cfg: CfgService, public log: LogService) {
this.title = this.cfg.options.appName;
this.log.critical('Logging critical');
this.log.error('Logging error and above');
this.log.warn('Logging warn and above');
this.log.info('Logging info and above');
this.log.debug('Logging debug and above');
}
}
@nwx/logger
depends on @nwx/cfg
for accessing the log level.LogLevels.debug
for development and LogLevels.warn
for production.@nwx/logger
should be imported at the root level of your application.LogLevels.none
.CfgService ready ...
2018-05-17T02:47:54.184Z [DEBUG] LogService ready ...
2018-05-17T02:47:54.188Z [DEBUG] GqlService ready ...
2018-05-17T02:47:54.375Z [DEBUG] I18nService ready ... (en)
2018-05-17T02:47:54.378Z [DEBUG] UixService ready ...
2018-05-17T02:47:54.379Z [DEBUG] JwtService ready ...
2018-05-17T02:47:54.384Z [DEBUG] Token expiry ... (21 seconds)
2018-05-17T02:47:54.388Z [DEBUG] AuthService ready ... (loggedIn)
2018-05-17T02:47:54.390Z [DEBUG] UsrService ready ...
2018-05-17T02:47:54.392Z [DEBUG] Web app starting now ...
2018-05-17T02:47:54.406Z [DEBUG] LayoutService ready ...
To run the tests against the current environment:
npm run ci
Released under a (MIT) license.
X.Y.Z Version
`MAJOR` version -- making incompatible API changes
`MINOR` version -- adding functionality in a backwards-compatible manner
`PATCH` version -- making backwards-compatible bug fixes
FAQs
A simple logger module for Angular applications
The npm package @nwx/logger receives a total of 2 weekly downloads. As such, @nwx/logger popularity was classified as not popular.
We found that @nwx/logger demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.