For better production support, logging is an important part. We can not use the console for logging messages on production environments. Instead, we can use file stream to save the log output. If you are a Windows user, you may have worked with Windows event log viewer where you can see all the log messages produced by the different applications. This section describes how we can use the Windows event viewer to manage the various logs from the Electron application.
The event viewer in Windows looks like the following image:
This utility is very useful to provide exception and warning information about the program to the end user. Let's look at how we can add some message to the event viewer from our Electron application. There is a third-party node module available called node-windows
to interact with the event viewer. This library provides some other useful features, such as event logging, windows service integrations, and so on. Install the library using npm into...