Console.log …or not?

POSTED ON

I bet that on your way developing components for SPFx you already know what console.log is and how to use it…but you know that there are also other useful methods?

Following the documentation here you can find all the supported methods, some of which are:

  • console.warn: used to output a warning in the browser’s console.
  • console.error: to output an error message in the browser’s console.
  • console.debug: outputs a message in the browser’s console with a debug log level.
  • console.info: enable the logging with an information log level.
  • console.clear: let you clear the browser’s console.
  • console.table: displays data as a table.
  • console.group: used with console.groupEnd enable the creation of a group indenting the output.
  • There are also different methods to enable the use of timers to track the timing of operations. To start a timer you can call console.time, to get the current elapsed time since the creation of the timer you can use console.timeLog, to stop the timer you have to call console.timeEnd.

I think that some of the methods are pretty useful while developing, if you’re interested in knowing more you can check the documentation.

Hope that helps!


Discover more from I am GuidoZam

Subscribe to get the latest posts sent to your email.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.