This project was generated with Angular CLI
npm install @lvo/logging --save-dev
import { LoggingModule } from '@lvo/logging';
@NgModule({
imports: [
LoggingModule,
...
import { Logger, LogManager } from '@lvo/logging';
@Injectable()
export class AClassWithLogging {
private logger: Logger;
constructor(private logManager: LogManager) {
// create Logger with Class Context
this.logger = logManager.getLogger(this);
// create logger with Context Hierarchy
// now you are able to switch all Logger in context ['c1','c2'] to debug level for example
this.logger.debug(['c1','c2','c3']);
// use Logger
this.logger.debug('Hello ..');
}
LogManager : log.logmanager
registered Logger : log.map
set log level : log.logmanager.setCurrentLogLevel(4, ['c1','c2'])
export enum LogLevel {
Verbose, // 1
Debug, // 2
Info, // 3
Warning, // 4
Error, // 5
Critical // 6
Quiet // 7
}
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run npm run build
to build the project. The build artifacts will be stored in the dist/
directory. Use the -prod
flag for a production build.
Run ng test @lvo/logging
to execute the unit tests via Karma.
Run ng test @lvo/logging --watch=false --code-coverage
to create a test coverage Report
Run ng e2e
to execute the end-to-end tests via Protractor.
Before running the tests make sure you are serving the app via ng serve
.
The MIT License (MIT)