Collect logs from both the Node.js backend and your frontend.
To help you get started with logging using Logtail, we have created an example project.
Make sure you have npm
installed and also make sure you have Node.js installed and up-to-date.
Clone the git repository or download it as a ZIP and extract it into a select directory which will be your projects directory.
Then run the following command to install all dependencies (@logtail/js
):
npm install
To run the example project, simply run the following command and don't forget to replace the <source-token>
with your actual source toke, which you can find in source settings.
node index.js <source-token>
You should see the following output:
Output:
All done! You can check your logs now.
This will generate a total of 4 logs, which can be displayed in your Logtail live monitor.
To learn more about using Logtail in your JavaScript projects, visit official documentation.