/rll-logger

Simple logging Angular2 module for Webpack bundling testing purposes.

Primary LanguageJavaScript

rll-logger

Simple logging Angular2 library.

Usage example

In order to use rll-logger in your application, you should follow these steps:

  1. Add the dependency to your project:
npm install --save rll-logger
  1. 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 {}
  1. 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');
    }
    ...
}