Backend: Error Monitoring
Go
Java
JS
Python
Ruby
Backend: Logging
Go
JS
Python
Ruby
Java
Hosting Providers
Backend: Tracing
Go
Node.js
Python
Native OpenTelemetry
Fullstack Frameworks
Overview
Self Host & Local Dev
Menu
Logging in Node.js
Learn how to set up highlight.io JS log ingestion without a logging library.
1
Set up your frontend highlight.io integration.
First, make sure you've followed the frontend getting started guide.
2
Install the relevant Highlight SDK(s).
Install @highlight-run/node with your package manager.
npm install --save @highlight-run/node
3
Initialize the Highlight JS SDK.
Initialize the Highlight JS SDK with your project ID.
import { H } from '@highlight-run/node'
H.init({
projectID: '<YOUR_PROJECT_ID>',
serviceName: '<YOUR_SERVICE_NAME>',
environment: 'production',
})
4
Call built-in console methods.
Logs are automatically recorded by the highlight SDK. Arguments passed as a dictionary as the second parameter will be interpreted as structured key-value pairs that logs can be easily searched by.
module.exports = function() {
console.log('hey there!');
console.warn('whoa there', {'key': 'value'});
}
5
Verify your backend logs are being recorded.
Visit the highlight logs portal and check that backend logs are coming in.