2023-09-02 23:44:03 +02:00
# COUT
2023-02-03 19:21:19 +01:00
2023-09-02 23:44:03 +02:00
This package allows you to use `cout` and debug levels in Node.js.
## Installation
Run this in your project folder:
```bash
npm install node-cout
```
## Usage
Learn how to use `node-cout` here:
### Import
2023-02-03 19:21:19 +01:00
```js
2023-09-02 23:44:03 +02:00
const cc = require('node-cout'); // CommonJS
2023-02-03 19:21:19 +01:00
2023-09-02 23:44:03 +02:00
import cc from 'node-cout'; // MJS or TypeScript
2023-02-03 19:21:19 +01:00
2023-09-02 23:44:03 +02:00
const cout = new cc(1, { save: true, emoji: true, types: ['loading', 'uploading'] });
2023-06-19 19:01:40 +02:00
```
2023-09-02 23:44:03 +02:00
> Parameters:
> ```
> debugLevel: number
> options?: {
> save?: boolean
> emoji?: boolean
> types?: string[]
> }
> ```
### Logging
2023-06-19 19:01:40 +02:00
```js
2023-09-02 23:44:03 +02:00
cout.debug('Hello World', 1); // Sends a debug log (1 is debug level, if its higher than the one defined in the constructor, its not going to be logged.)
cout.info('Hello World'); // Sends an info log
cout.warn('Hello World'); // Sends a warning log
cout.error('Hello World'); // Sends an error log
cout.log('Hello World'); // Sends a normal log
2023-07-08 16:22:05 +02:00
```
2023-09-02 23:44:03 +02:00
If you want to use the `types` option, you can do it like this:
2023-07-08 17:20:39 +02:00
2023-09-02 23:44:03 +02:00
```js
cout.debug('Hello World', 1, types);
```
2023-07-08 16:38:38 +02:00
2023-09-02 23:44:03 +02:00
`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.