How to write custom logging function in JavaScript

In this article we will be discussing, how to write custom logging function in JavaScript. Javascript provide various logging function by default like:

Why Custom Logging: But there are various instances when you would like to have custom logging function. Some of these instances might be like : Logging messages based on components basis(Each logging message have component name prefixed). Enable/disable logging with a flag, e.g., isDebug = true i.e You might want to have logs while development while no logs for production environment. Short logging syntax i.e logs(“Hello world”);   Above are just some common example in case …

Continue Reading