@halfdevil/ngx-logger
v2.0.5
Published
```shell npm i @halfdevil/ngx-logger ``` ### Step 2: Import the NgxLoggingService: ```js import { NgxLoggingService } from '@halfdevil/ngx-logger';
Downloads
30
Readme
NgxLogging
It is a library of Angular that allows you to Log the data to the Server.
Getting started
Step 1: Install @halfdevil/ngx-logger
:
NPM
npm i @halfdevil/ngx-logger
Step 2: Import the NgxLoggingService:
import { NgxLoggingService } from '@halfdevil/ngx-logger';
@Component({
selector: 'app-init',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
constructor(private logger: NgxLoggingService) {
this.logger.API_URL = "YOUR API URL";
this.logger.Request_Type = "GET For Get Request, POST For Post Request";
// Log Level: Info
this.logger.info("Your Message", [Optional Params]);
// Log Level: Debug
this.logger.debug("Your Message", [Optional Params]);
// Log Level: Warn
this.logger.warn("Your Message", [Optional Params]);
// Log Level: Error
this.logger.error("Your Message", [Optional Params]);
// Log Level: Fatal
this.logger.fatal("Your Message", [Optional Params]);
// Log Level: All
this.logger.log("Your Message", [Optional Params]);
// Want To Turn Off Logs
this.logger.level = this.logger.LogLevel.Off;
// Optional
this.logger.ShowAPIOutput = true; // Shows Output (Success, Error) in Console Log Not to be Used In Production.
this.logger.logWithDate = true; // If you want to also include date of log.
}
}