node-cout
This package allows you to use cout
and debug levels in Node.js.
Installation
Run this in your project folder:
npm install node-cout
Usage
Learn how to use node-cout
here:
Import
import cc from 'node-cout';
const cout = new cc(1, { save: true, emoji: true, types: ['loading', 'uploading'] });
You're using CommonJS and can use require()
instead of import
? Go on troubleshooting.
Parameters:
debugLevel: number
options?: {
save?: boolean
emoji?: boolean
types?: string[]
}
Logging
cout.debug('Hello World', 1);
cout.info('Hello World');
cout.warn('Hello World');
cout.error('Hello World');
cout.log('Hello World');
If you want to use the types
option, you can do it like this:
cout.debug('Hello World', 1, types);
types
can either be a string or an array of strings, and if one of them matches with one of the types defined in the constructor, the log is going to be logged.
Troubleshooting
Unfortunately, this is not supported anymore:
const cc = require('node-cout');
If you want to import
the package in your CommonJS project, add this to your package.json
file:
{
"type": "module"
}