Node JS
How to instrument Tailed from Node with just three lines of code.
Setup
Install the @tailedapp/nodejs-lib
npm package:
Basic Usage
You will need to create a new ConsoleSession
and then start it:
Choose the right point at which to start the ConsoleSession
. For example, if you're asking the user for credentials or a connection string, you'll want to start the session after that point so you don't stream those details to everyone viewing the session.
Any logging framework that has a console output can be used together with the above configuration code.
Default Colorization
The following default color rules apply:
console.info
will write content with a green color;console.warn
will write content with a yellow color;console.error
will write content with a red color;stderr.write
will write content with a red color.In all other cases, the colors will be the defaults.
Customization Options
The constructor on the ConsoleSession
allows you to specify a custom hostname to use in the session URL (instead of tailed.live
).
Last updated