Simple logging Angular2 library.
In order to use rll-logger in your application, you should follow these steps:
- Add the dependency to your project:
npm install --save rll-logger
- Import it on your application.
You can configure the logging level by injecting the desired level using the Level class.
import { Level, RllLoggerModule } from 'rll-logger';
@NgModule({
imports: [
...
RllLoggerModule.forRoot(Level.DEBUG),
...
],
declarations: [
...
],
providers: [
...
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
- Add it on your services:
import { LoggerService } from 'rll-logger';
@Injectable()
export class YourService {
...
constructor(private logger: LoggerService) {
}
...
yourFunction() {
this.logger.debug('This is a debug trace');
}
...
}