To simplify adding JustLog.IT logging into your Node.js applications we built a wrapper library.
Follow these steps to get our node.js library installed and running in your node.js application.
This is the list of methods on the logging interface you can call to store values from your running web application.
Method | Parameters | Description |
---|---|---|
logPerformance |
| Logs a performance record. Performance is calculated by taking the start and endtimestamps (Date objects) and getting the millisecond difference between them. |
logEvent |
| Logs an event occurrence for the application. |
logError |
| Logs the details of an error. The error object is expected to have thedefault error object properties (message and stack) |
logInformation |
| Writes an information log entry into the system. These are useful to provide context to otherentries, especially errors. |
setAppActionInterval |
| Sets the collection interval for the app actions. This interval determines how long the app actions will be collected before they are logged to the JustLog.IT system. |
logAppAction |
| Logs an app action instance. These will be collected for the given interval and then automatically logged as a batch. |
The node library is designed to be as light-weight as possible. To that end all the methods listed above employ"fira and forget" execution. You call the method and it executes asynchronously but the do not have a callback method to return results. So just call the method with the required parameters and let your code continue executing. That does make it impossible to use the logging to control code execution flow but that has not been a problem so far.
This library uses the standard http(s) libraries that come with node to execute the calls. The error logging executesa POST to the log collector. The other 3 methods execute a GET request.