Skip to content

ConsoleLog and vebose logging RxJsDebug

Compare
Choose a tag to compare
@PGTBoos PGTBoos released this 31 Jul 12:09
· 8 commits to main since this release
66fd70f

Added ConsoleLog
This can be used as a replacement for console.log
It works just as console.log, but only outputs in development mode, and if a local variable is set to true (ea this.verbose)
Note that it is not my goal to ban console.log but this allows to enable extra logging on a per file basis (bug cases).

ConsoleLog(this.verbose, 'anything like you did before with console', showVarsEtc, anotherVar);`

Updated RxJsDebug
RxJs can be turned of globally within the RxJs-Debug.ts file, but now by use of an override it can also be controled by a verbose value.
I think this is a handy update as RXJS typically concerns serveral areas within an app and you might not want to get logging from all of them.

 .pipe( RxJsDebug(  RxJsLoggingLevel.INFO, 'Edit mode:' ));
 
 //There is also a overload to use a verbose boolean, that then also should be true (for per file debugging)
 .pipe( RxJsDebug(this.verbose, RxJsLoggingLevel.INFO, 'Edit mode:' ));
 
 //And if you want to see a stack trace as well add a boolean true at the end of RxJsDebug
 .pipe( RxJsDebug(this.verbose, RxJsLoggingLevel.INFO, 'Edit mode:' , true));

(while writing i wonder if we should put a Force boolean too, to enforce logging of all under debug, ... if people want it drop me an issue)