How to use the ngx-logger.NgxLoggerLevel.LOG function in ngx-logger

To help you get started, we’ve selected a few ngx-logger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dbfannin / ngx-logger / projects / demo / src / app / logger-form / logger-form.component.ts View on Github external
* This component emits an event to the parent of the message and log type so the parent can perform the logging operation.
 */
export class LoggerFormComponent implements OnInit {
  @Output() logToConsole: EventEmitter = new EventEmitter();

  loggerForm = this.fb.group({
    logMessage: ['', Validators.required],
    logType: ['', Validators.required]
  });

  /* Used in the mat-select on the form */
  logTypes: LoggerSelectionOption[] = [
    {value: NgxLoggerLevel.TRACE, viewValue: 'Trace'},
    {value: NgxLoggerLevel.DEBUG, viewValue: 'Debug'},
    {value: NgxLoggerLevel.INFO, viewValue: 'Info'},
    {value: NgxLoggerLevel.LOG, viewValue: 'Log'},
    {value: NgxLoggerLevel.WARN, viewValue: 'Warn'},
    {value: NgxLoggerLevel.ERROR, viewValue: 'Error'}
  ];

  constructor(private fb: FormBuilder) {
  }

  ngOnInit() {
  }

  /**
   * Take the message and type of logging to be performed and emits it to the parent component.
   */
  handleFormSubmission() {
    this.logToConsole.emit(this.loggerForm.value);
  }
github dbfannin / ngx-logger / projects / demo / src / app / app.component.ts View on Github external
handleLog(log: LogEvent) {
    switch (log.logType) {
      case NgxLoggerLevel.TRACE:
        this.logger.trace(log.logMessage);
        break;
      case NgxLoggerLevel.DEBUG:
        this.logger.debug(log.logMessage);
        break;
      case NgxLoggerLevel.INFO:
        this.logger.info(log.logMessage);
        break;
      case NgxLoggerLevel.LOG:
        this.logger.log(log.logMessage);
        break;
      case NgxLoggerLevel.WARN:
        this.logger.warn(log.logMessage);
        break;
      case NgxLoggerLevel.ERROR:
        this.logger.error(log.logMessage);
        break;
      case NgxLoggerLevel.FATAL:
        this.logger.fatal(log.logMessage);
        break;
    }
  }
}
github dbfannin / ngx-logger / projects / demo / src / app / log-config / log-config.component.ts View on Github external
get loggerColor(): string {
    switch (this.currentLogLevel) {
      case NgxLoggerLevel.TRACE:
      case NgxLoggerLevel.DEBUG:
        return 'primary';

      case NgxLoggerLevel.INFO:
      case NgxLoggerLevel.LOG:
        return 'accent';

      case NgxLoggerLevel.WARN:
      case NgxLoggerLevel.ERROR:
      case NgxLoggerLevel.FATAL:
        return 'warn';

      default:
        return '';
    }
  }