mperdeck / jsnlog.js

Tiny JavaScript logging library, simple and well documented. Lots of options to filter logging data.
js.jsnlog.com
Other
130 stars 43 forks source link

Debug and Trace level is not logging in Console even if the level is set to Trace/Debug/All #42

Closed manojp1988 closed 7 years ago

manojp1988 commented 7 years ago

In Angular 2 application, I have created two appenders and injected the JL as per the document.

app.module.ts

var ajaxAppender = JL.createAjaxAppender('ajaxAppender');
ajaxAppender.setOptions({
  "batchSize": 6,
  "bufferSize": 40,
})
var consoleAppender = JL.createConsoleAppender('consoleAppender');

JL().setOptions({
  level:1000,
  "appenders": [consoleAppender, ajaxAppender]
});

  providers: [
    { provide: 'JSNLOG', useValue: JL },
     AppService,
  ],

app.component.ts

constructor(@Inject('JSNLOG') JL: JL.JSNLog) {
    this.JL = JL;
}
ngOnInit() {
    this.JL().trace("It is a trace message");
    this.JL().debug("It is a debug message");
    this.JL().info("It is info message");
    this.JL().warn("It is a warn message");
    this.JL().error("It is a error message");
    this.JL().fatal("It is a fatal message");
  }

In the console, only info and above messages are showing. But not trace and debug. AjaxAppender is showing trace and above as expected.

mperdeck commented 7 years ago

I guess you're using Chrome.

Chrome allows you to filter log messages to the console. By default, the lowest severity in Chrome, "verbose" is disabled. JSNLog maps trace and debug to "verbose".

To solve this, in the Chrome debugger, in the Console tab, change the dropdown from Info to Verbose. See the attached screenshot. capture

manojp1988 commented 7 years ago

Thank you. It is showing now after configuring chrome.