If you don't have yarn installed, install it globally:
npminstall--globalyarn
Example
The library is really easy to work with, simply import it and use your Stream and Project API keys
logger.js
constLogshqLogger=require('@logshq.io/node');// Credentialsconstlogger=newLogshqLogger({ project_id:'SOME-PROJECT-ID', api_key:'SOME-STREAM-KEY', environment:process.env.NODE_ENV,// optional hostname:'auth-service',// optional});// debug; one of the library's methodslogger.debug('Email successfully sent after registration', { step:'Step 3', method:'signUp', module:'auth.js', correlationId:'326126b5-6918-4624-8c19-0730587c5cd6'});// export logger for later usemodule.exports= logger
As a result, the following JSON rows will be ingested
{"environment":"production","facility":"Node.js","facility_version":"v16.17.1","library_version":"V1","hostname":"auth-service","metaData": {"step":"Step 3","method":"signUp","module":"auth.js","correlationId":"326126b5-6918-4624-8c19-0730587c5cd6" },"level":"debug","message":"Email successfully sent after registration","timestamp":"2023-01-22T22:44:27.320Z","uuid":"d50cfb9e-0a9e-4a35-9b62-3e798d951bba"}
You can perform search using any of the data that you have sent once the log is received: