This library provides a simple way for logging anything what you need.
Just run this command in root of your project:
npm install ng-logx
Then you can import NgLogx
decorator with your class method.
For instance:
import { NgLogx } from "ng-logx";
@NgLogx({ type: LogType.SYNC, level: LogLevel.INFO })
private syncOperation(): string {
return "Hello, World!";
}
Or:
import { NgLogx } from "ng-logx";
@NgLogx({ type: LogType.ASYNC, level: LogLevel.WARNING })
private asyncOperation(): Observable<any> {
return this.http.get('/api/posts');
}
Basically @ngLogx
decorator takes parameter as NgLogxParameters
.
Here we have possible options for that:
Possible values: LogLevel.INFO
, LogLevel.WARNING
, LogLevel.ERROR
Description: level
parameter related to visual style and type of your logged message.
It has relation with standard Console
object.
Possible values: LogType.SYNC
, LogType.ASYNC
Description: type
related to type of your method - standard synchronized or implemented by RxJS's Observable
type.
Possible values: true
or false
Description: enable
option needs to turn off log feature if you don't need it at the moment.
Description: options
contains some CSS-like rules about how to display whole message.