LOGIN
START FREE TRIAL

Node.js

Step 1: Install logsense dependency

npm i logsense

Step 2: Initialize logsense in your main file

const logsense = require('logsense')('CUSTOMER_TOKEN')

Please replace CUSTOMER_TOKEN with the value available in Customer Tokens section of the user portal.

Step 3: Capture logs

Capture all console statements by adding:

logsense.install()

or, for Winston:

logger.add(new logsense.WinstonTransport())

Step 4: Start logging

By adding logsense.install() in your main file, all console statements will be sent to LogSense. If you want to send structured logs, pass an object as the last console statement argument.