Added Troubleshooting section

This commit is contained in:
mambuco 2023-09-03 00:07:21 +02:00
parent 662b7ea482
commit 9494c7f1a1

View file

@ -1,4 +1,4 @@
# COUT
# node-cout
This package allows you to use `cout` and debug levels in Node.js.
@ -17,13 +17,13 @@ Learn how to use `node-cout` here:
### Import
```js
const cc = require('node-cout'); // CommonJS
import cc from 'node-cout'; // MJS or TypeScript
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](#troubleshooting).
> Parameters:
> ```
> debugLevel: number
@ -54,4 +54,20 @@ 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.
`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:
```js
const cc = require('node-cout');
```
If you want to `import` the package in your CommonJS project, add this to your `package.json` file:
```json
{
"type": "module"
}
```