RfxLogger
Upgrade for browser console messages
Features
- One-line compact view
- All messages have intuitive colors
- Message tag supports HTTP codes
- Intercept HTTP calls and automatically prints message to the console
Installation
Install the npm package:
npm install rfx-logger
Import module and interceptor:
- interceptor is optional
.config
is optional if you want to disable debug data (useful for production). Default is false
import { RfxLoggerModule, RfxLoggerInterceptor } from 'rfx-logger';
import { HTTP_INTERCEPTORS } from '@angular/common/http';
@NgModule({
imports: [
RfxLoggerModule.config({
disableDebug: true
})
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: RfxLoggerInterceptor,
multi: true
}
],
})
Usage
- message
custom string (eg. function name)
- data
optional, any object you want to print with the debug message (eg. backend data)
import { RfxLoggerService } from 'rfx-logger';
[...]
constructor(rfxLoggerService: RfxLoggerService) { }
[...]
this.rfxLoggerService.success(message, data);
this.rfxLoggerService.warning(message, data);
this.rfxLoggerService.error(message, data);
Demo
https://demo.redfoxxo.dev/rfx-logger
License
This project is licensed under the MIT License