chromalogger 1.1.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +77 -43
- package/index.js +10 -61
- package/package.json +10 -25
- package/.eslintrc.json +0 -18
- package/.prettierrc +0 -9
- package/CHROMA.md +0 -253
- package/CONTRIBUTING.md +0 -43
- package/INFO.md +0 -128
- package/README.fr.md +0 -360
- package/chromalog.js +0 -77
- package/cli.js +0 -87
- package/core/formatters/objectFormatter.js +0 -131
- package/core/loggers/consoleLogger.js +0 -218
- package/core/styles.js +0 -75
- package/core/utils/validate.js +0 -45
- package/test.js +0 -159
- package/utils/chroma.js +0 -42
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,66 +1,100 @@
|
|
|
1
1
|
# ChromaLogger
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
[](https://github.com/OrssiMp/chromalogger/stargazers)
|
|
3
|
+
> A powerful and colorful logger for Node.js with advanced formatting
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
ChromaLogger is a powerful and flexible Node.js console logging library with advanced support for colors, styles, and debugging features. Perfect for Node.js application development and debugging.
|
|
10
|
-
|
|
11
|
-
## 🚀 Features
|
|
12
|
-
|
|
13
|
-
- 🌈 Rich color and style support (16+ colors, text formatting)
|
|
14
|
-
- 📊 Built-in log levels (DEBUG, INFO, WARN, ERROR)
|
|
15
|
-
- 🔄 Circular reference detection
|
|
16
|
-
- 📝 Template string support
|
|
17
|
-
- 🛠️ Customizable loggers
|
|
18
|
-
- 💻 CLI tool included
|
|
19
|
-
- 🔌 Extensible architecture
|
|
20
|
-
|
|
21
|
-
## 📦 Installation
|
|
5
|
+
## Installation
|
|
22
6
|
|
|
23
7
|
```bash
|
|
24
|
-
# With npm
|
|
25
8
|
npm install chromalogger
|
|
9
|
+
```
|
|
26
10
|
|
|
27
|
-
|
|
28
|
-
|
|
11
|
+
## Basic Usage
|
|
12
|
+
|
|
13
|
+
```javascript
|
|
14
|
+
import { logger } from 'chromalogger';
|
|
15
|
+
|
|
16
|
+
// Basic logging
|
|
17
|
+
logger.info('This is an info message');
|
|
18
|
+
logger.success('Operation completed successfully!');
|
|
19
|
+
logger.warn('This is a warning');
|
|
20
|
+
logger.error('An error occurred');
|
|
29
21
|
```
|
|
30
22
|
|
|
31
|
-
##
|
|
23
|
+
## Advanced Formatting
|
|
24
|
+
|
|
25
|
+
ChromaLogger provides a flexible `format()` method for custom styling:
|
|
32
26
|
|
|
33
27
|
```javascript
|
|
34
|
-
|
|
28
|
+
// Single style
|
|
29
|
+
logger.format(colors.red, 'This text will be red');
|
|
35
30
|
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
// Multiple styles combined
|
|
32
|
+
logger.format(
|
|
33
|
+
[colors.bold, colors.bgBlue, colors.white],
|
|
34
|
+
'Bold white text on blue background'
|
|
35
|
+
);
|
|
41
36
|
|
|
42
|
-
// With
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
// With timestamps
|
|
38
|
+
logger.setTimestamp(true);
|
|
39
|
+
logger.format(colors.green, 'This will include a timestamp');
|
|
45
40
|
|
|
46
|
-
//
|
|
47
|
-
const
|
|
48
|
-
|
|
41
|
+
// Create reusable themes
|
|
42
|
+
const errorTheme = [colors.bright, colors.red];
|
|
43
|
+
const successTheme = [colors.bright, colors.green];
|
|
44
|
+
|
|
45
|
+
logger.format(errorTheme, 'Error: Something went wrong!');
|
|
46
|
+
logger.format(successTheme, 'Success: Operation completed!');
|
|
49
47
|
```
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
### Available Styles
|
|
50
|
+
|
|
51
|
+
ChromaLogger includes several built-in styles:
|
|
52
|
+
|
|
53
|
+
- **Text Colors**: black, red, green, yellow, blue, magenta, cyan, white
|
|
54
|
+
- **Background Colors**: bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite
|
|
55
|
+
- **Text Styles**: bright, dim, italic, underline, blink, reverse, hidden
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- Colorful console output
|
|
60
|
+
- Advanced formatting options
|
|
61
|
+
- Optional timestamps
|
|
62
|
+
- Reusable style themes
|
|
63
|
+
- Browser support with styled console groups
|
|
52
64
|
|
|
53
|
-
|
|
65
|
+
## Browser Support
|
|
66
|
+
|
|
67
|
+
ChromaLogger works in modern browsers with full styling support:
|
|
68
|
+
|
|
69
|
+
```javascript
|
|
70
|
+
// In your browser code
|
|
71
|
+
import { browser } from 'chromalogger';
|
|
72
|
+
|
|
73
|
+
// All logging methods work in the browser
|
|
74
|
+
browser.info('Browser info message');
|
|
75
|
+
browser.success('Operation completed in browser!');
|
|
76
|
+
browser.warn('Browser warning');
|
|
77
|
+
browser.error('Browser error occurred');
|
|
78
|
+
|
|
79
|
+
// With timestamps
|
|
80
|
+
browser.setTimestamp(true);
|
|
81
|
+
browser.info('This message has a timestamp');
|
|
82
|
+
```
|
|
54
83
|
|
|
55
|
-
|
|
84
|
+
### Browser-Specific Features
|
|
56
85
|
|
|
57
|
-
|
|
86
|
+
- **Collapsible Groups**: Info and success logs are displayed in collapsible groups
|
|
87
|
+
- **Native Console Methods**: Uses `console.warn` and `console.error` for warnings and errors
|
|
88
|
+
- **Responsive Design**: Logs adapt to the browser's console width
|
|
58
89
|
|
|
59
|
-
|
|
90
|
+
### Supported Browsers
|
|
60
91
|
|
|
61
|
-
|
|
92
|
+
- Chrome 30+
|
|
93
|
+
- Firefox 25+
|
|
94
|
+
- Edge 12+
|
|
95
|
+
- Safari 7+
|
|
96
|
+
- Opera 15+
|
|
62
97
|
|
|
63
|
-
##
|
|
98
|
+
## License
|
|
64
99
|
|
|
65
|
-
|
|
66
|
-
- Thanks to all contributors who have helped improve this project
|
|
100
|
+
MIT
|
package/index.js
CHANGED
|
@@ -1,61 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* // Création d'un logger personnalisé
|
|
13
|
-
* const myLogger = chromalog.createLogger('green', 'underline');
|
|
14
|
-
* myLogger('Message personnalisé');
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// Import core modules
|
|
18
|
-
import * as styles from './core/styles.js';
|
|
19
|
-
import {
|
|
20
|
-
createLogger,
|
|
21
|
-
formatMessage,
|
|
22
|
-
setLogLevel,
|
|
23
|
-
LOG_LEVELS,
|
|
24
|
-
} from './core/loggers/consoleLogger.js';
|
|
25
|
-
import { formatObject } from './core/formatters/objectFormatter.js';
|
|
26
|
-
|
|
27
|
-
// Créer les loggers avec leurs styles respectifs
|
|
28
|
-
const log = createLogger();
|
|
29
|
-
const debug = createLogger('dim');
|
|
30
|
-
const info = createLogger('cyan');
|
|
31
|
-
const warn = createLogger('yellow');
|
|
32
|
-
const error = createLogger('red');
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* ChromaLog - A powerful console logger with rich formatting and styling
|
|
36
|
-
*/
|
|
37
|
-
const ChromaLog = {
|
|
38
|
-
// Core
|
|
39
|
-
styles,
|
|
40
|
-
createLogger,
|
|
41
|
-
formatMessage,
|
|
42
|
-
formatObject,
|
|
43
|
-
setLogLevel,
|
|
44
|
-
LOG_LEVELS: { ...LOG_LEVELS },
|
|
45
|
-
|
|
46
|
-
// Loggers
|
|
47
|
-
log: (...args) => log(...args),
|
|
48
|
-
debug: (...args) => debug(...args),
|
|
49
|
-
info: (...args) => info(...args),
|
|
50
|
-
warn: (...args) => warn(...args),
|
|
51
|
-
error: (...args) => error(...args),
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
// Exporter les loggers individuellement
|
|
55
|
-
export { log, debug, info, warn, error };
|
|
56
|
-
|
|
57
|
-
// Exporter les fonctions utilitaires
|
|
58
|
-
export { styles, createLogger, formatMessage, formatObject, setLogLevel, LOG_LEVELS };
|
|
59
|
-
|
|
60
|
-
// Exporter par défaut l'objet ChromaLog
|
|
61
|
-
export default ChromaLog;
|
|
1
|
+
export * from './modules/chromalog.js';
|
|
2
|
+
export * from './modules/chromalog.browser.js';
|
|
3
|
+
|
|
4
|
+
import { logger } from './modules/chromalog.js';
|
|
5
|
+
import { browser } from './modules/chromalog.browser.js';
|
|
6
|
+
|
|
7
|
+
export { logger, browser };
|
|
8
|
+
|
|
9
|
+
export default logger;
|
|
10
|
+
|
package/package.json
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chromalogger",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "A colorful and flexible console logger for Node.js with CLI support",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"browser": "chromalog.browser.js",
|
|
6
7
|
"type": "module",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
8
|
+
"files": [
|
|
9
|
+
"index.js",
|
|
10
|
+
"chromalog.js",
|
|
11
|
+
"chromalog.browser.js"
|
|
12
|
+
],
|
|
13
|
+
"browserslist": "> 0.5%, last 2 versions, not dead",
|
|
10
14
|
"scripts": {
|
|
11
|
-
"test": "node
|
|
12
|
-
"test:watch": "nodemon --watch chromalog.js --watch test.js --exec \"npm test\"",
|
|
13
|
-
"lint": "eslint .",
|
|
14
|
-
"test:chroma": "node chromatest.js",
|
|
15
|
-
"test:cli": "node clitest.js",
|
|
16
|
-
"test:all": "npm run test && npm run test:chroma && npm run test:cli",
|
|
17
|
-
"format": "prettier --write .",
|
|
18
|
-
"fix": "eslint --fix .",
|
|
19
|
-
"coverage": "c8 npm test"
|
|
15
|
+
"test": "node ./ideas/demo.js"
|
|
20
16
|
},
|
|
21
17
|
"keywords": [
|
|
22
18
|
"log",
|
|
@@ -48,16 +44,5 @@
|
|
|
48
44
|
},
|
|
49
45
|
"engines": {
|
|
50
46
|
"node": ">=12.0.0"
|
|
51
|
-
},
|
|
52
|
-
"dependencies": {
|
|
53
|
-
"util": "^0.12.5"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"c8": "^10.1.3",
|
|
57
|
-
"eslint": "^8.0.0",
|
|
58
|
-
"eslint-config-prettier": "^10.1.8",
|
|
59
|
-
"eslint-plugin-prettier": "^5.5.4",
|
|
60
|
-
"nodemon": "^3.1.11",
|
|
61
|
-
"prettier": "^3.7.3"
|
|
62
47
|
}
|
|
63
48
|
}
|
package/.eslintrc.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"node": true,
|
|
4
|
-
"es2021": true,
|
|
5
|
-
"browser": true
|
|
6
|
-
},
|
|
7
|
-
"extends": ["eslint:recommended", "prettier"],
|
|
8
|
-
"parserOptions": {
|
|
9
|
-
"ecmaVersion": 2021,
|
|
10
|
-
"sourceType": "module"
|
|
11
|
-
},
|
|
12
|
-
"rules": {
|
|
13
|
-
"no-console": "off",
|
|
14
|
-
"no-unused-vars": ["warn", { "argsIgnorePattern": "^_" }],
|
|
15
|
-
"prettier/prettier": "error"
|
|
16
|
-
},
|
|
17
|
-
"plugins": ["prettier"]
|
|
18
|
-
}
|
package/.prettierrc
DELETED
package/CHROMA.md
DELETED
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
# Chroma Utility
|
|
2
|
-
|
|
3
|
-
[🇬🇧 English](#chroma-utility) | [🇫🇷 Français](#utilitaire-chroma)
|
|
4
|
-
|
|
5
|
-
## Chroma Utility
|
|
6
|
-
|
|
7
|
-
Chroma is a simple utility function for styling console text output in Node.js applications. It's part of the ChromaLogger package and provides a convenient way to apply ANSI color and style codes to your console output.
|
|
8
|
-
|
|
9
|
-
## 🔧 Installation
|
|
10
|
-
|
|
11
|
-
Chroma is included with ChromaLogger. No additional installation is needed if you already have ChromaLogger installed.
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# If you need to install ChromaLogger
|
|
15
|
-
npm install chromalogger
|
|
16
|
-
# or
|
|
17
|
-
yarn add chromalogger
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
## 🚀 Quick Start
|
|
21
|
-
|
|
22
|
-
```javascript
|
|
23
|
-
import chroma from 'chromalogger/utils/chroma.js';
|
|
24
|
-
|
|
25
|
-
// Basic usage
|
|
26
|
-
chroma('This text is red and bold', 'red', 'bright');
|
|
27
|
-
|
|
28
|
-
// Multiple styles
|
|
29
|
-
chroma('Blue text on white background', 'blue', 'bgWhite');
|
|
30
|
-
|
|
31
|
-
// Using with template literals
|
|
32
|
-
const name = 'Alice';
|
|
33
|
-
chroma(`Hello, ${name}!`, 'green', 'underline');
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
## 📚 API Reference
|
|
37
|
-
|
|
38
|
-
### `chroma(text, ...styleNames)`
|
|
39
|
-
|
|
40
|
-
Applies the specified styles to the text and logs it to the console.
|
|
41
|
-
|
|
42
|
-
**Parameters:**
|
|
43
|
-
- `text` (string): The text to style and log
|
|
44
|
-
- `...styleNames` (string): One or more style names to apply
|
|
45
|
-
|
|
46
|
-
**Returns:** `undefined`
|
|
47
|
-
|
|
48
|
-
## 🎨 Available Styles
|
|
49
|
-
|
|
50
|
-
### Text Colors
|
|
51
|
-
- `black`
|
|
52
|
-
- `red`
|
|
53
|
-
- `green`
|
|
54
|
-
- `yellow`
|
|
55
|
-
- `blue`
|
|
56
|
-
- `magenta`
|
|
57
|
-
- `cyan`
|
|
58
|
-
- `white`
|
|
59
|
-
|
|
60
|
-
### Background Colors
|
|
61
|
-
- `bgBlack`
|
|
62
|
-
- `bgRed`
|
|
63
|
-
- `bgGreen`
|
|
64
|
-
- `bgYellow`
|
|
65
|
-
- `bgBlue`
|
|
66
|
-
- `bgMagenta`
|
|
67
|
-
- `bgCyan`
|
|
68
|
-
- `bgWhite`
|
|
69
|
-
|
|
70
|
-
### Text Styles
|
|
71
|
-
- `bright` (bold)
|
|
72
|
-
- `dim`
|
|
73
|
-
- `italic`
|
|
74
|
-
- `underline`
|
|
75
|
-
- `blink`
|
|
76
|
-
- `reverse` (swap foreground and background)
|
|
77
|
-
- `hidden`
|
|
78
|
-
- `strikethrough`
|
|
79
|
-
|
|
80
|
-
## 📝 Examples
|
|
81
|
-
|
|
82
|
-
### Basic Usage
|
|
83
|
-
|
|
84
|
-
```javascript
|
|
85
|
-
import chroma from 'chromalogger/utils/chroma.js';
|
|
86
|
-
|
|
87
|
-
// Simple colored text
|
|
88
|
-
chroma('Error: Something went wrong!', 'red');
|
|
89
|
-
|
|
90
|
-
// Multiple styles
|
|
91
|
-
chroma('Warning: This is important!', 'yellow', 'bright', 'underline');
|
|
92
|
-
|
|
93
|
-
// Background color
|
|
94
|
-
chroma('Success!', 'green', 'bgBlack');
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### Advanced Usage
|
|
98
|
-
|
|
99
|
-
```javascript
|
|
100
|
-
// Create reusable styled log functions
|
|
101
|
-
const success = (text) => chroma(text, 'green', 'bright');
|
|
102
|
-
const error = (text) => chroma(text, 'red', 'bright');
|
|
103
|
-
const warning = (text) => chroma(text, 'yellow', 'bright');
|
|
104
|
-
|
|
105
|
-
// Use them throughout your application
|
|
106
|
-
success('Operation completed successfully!');
|
|
107
|
-
error('Failed to connect to the server');
|
|
108
|
-
warning('This feature is deprecated');
|
|
109
|
-
|
|
110
|
-
// Conditional styling
|
|
111
|
-
const status = 'success';
|
|
112
|
-
chroma(
|
|
113
|
-
`Status: ${status}`,
|
|
114
|
-
status === 'success' ? 'green' : 'red',
|
|
115
|
-
'bright'
|
|
116
|
-
);
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## ⚠️ Notes
|
|
120
|
-
|
|
121
|
-
- Chroma is designed for Node.js environments with console support
|
|
122
|
-
- Colors may not display correctly in all terminals
|
|
123
|
-
- For more complex logging needs, consider using the full ChromaLogger package
|
|
124
|
-
|
|
125
|
-
## 📄 License
|
|
126
|
-
|
|
127
|
-
MIT - See [LICENSE](LICENSE) for more information.
|
|
128
|
-
|
|
129
|
-
---
|
|
130
|
-
|
|
131
|
-
## Utilitaire Chroma
|
|
132
|
-
|
|
133
|
-
[🇬🇧 English](#chroma-utility) | [🇫🇷 Français](#utilitaire-chroma)
|
|
134
|
-
|
|
135
|
-
## 📦 Installation
|
|
136
|
-
|
|
137
|
-
Chroma est inclus avec ChromaLogger. Aucune installation supplémentaire n'est nécessaire si vous avez déjà installé ChromaLogger.
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
# Si vous devez installer ChromaLogger
|
|
141
|
-
npm install chromalogger
|
|
142
|
-
# ou
|
|
143
|
-
yarn add chromalogger
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
## 🚀 Démarrage Rapide
|
|
147
|
-
|
|
148
|
-
```javascript
|
|
149
|
-
import chroma from 'chromalogger/utils/chroma.js';
|
|
150
|
-
|
|
151
|
-
// Utilisation de base
|
|
152
|
-
chroma('Ce texte est en rouge et en gras', 'red', 'bright');
|
|
153
|
-
|
|
154
|
-
// Styles multiples
|
|
155
|
-
chroma('Texte bleu sur fond blanc', 'blue', 'bgWhite');
|
|
156
|
-
|
|
157
|
-
// Avec des littéraux de gabarit
|
|
158
|
-
const nom = 'Alice';
|
|
159
|
-
chroma(`Bonjour, ${nom} !`, 'green', 'underline');
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
## 📚 Référence de l'API
|
|
163
|
-
|
|
164
|
-
### `chroma(texte, ...nomsStyles)`
|
|
165
|
-
|
|
166
|
-
Applique les styles spécifiés au texte et l'affiche dans la console.
|
|
167
|
-
|
|
168
|
-
**Paramètres :**
|
|
169
|
-
- `texte` (string) : Le texte à styliser et à afficher
|
|
170
|
-
- `...nomsStyles` (string) : Un ou plusieurs noms de styles à appliquer
|
|
171
|
-
|
|
172
|
-
**Retourne :** `undefined`
|
|
173
|
-
|
|
174
|
-
## 🎨 Styles Disponibles
|
|
175
|
-
|
|
176
|
-
### Couleurs de texte
|
|
177
|
-
- `black` (noir)
|
|
178
|
-
- `red` (rouge)
|
|
179
|
-
- `green` (vert)
|
|
180
|
-
- `yellow` (jaune)
|
|
181
|
-
- `blue` (bleu)
|
|
182
|
-
- `magenta` (magenta)
|
|
183
|
-
- `cyan` (cyan)
|
|
184
|
-
- `white` (blanc)
|
|
185
|
-
|
|
186
|
-
### Couleurs d'arrière-plan
|
|
187
|
-
- `bgBlack` (fond noir)
|
|
188
|
-
- `bgRed` (fond rouge)
|
|
189
|
-
- `bgGreen` (fond vert)
|
|
190
|
-
- `bgYellow` (fond jaune)
|
|
191
|
-
- `bgBlue` (fond bleu)
|
|
192
|
-
- `bgMagenta` (fond magenta)
|
|
193
|
-
- `bgCyan` (fond cyan)
|
|
194
|
-
- `bgWhite` (fond blanc)
|
|
195
|
-
|
|
196
|
-
### Styles de texte
|
|
197
|
-
- `bright` (gras)
|
|
198
|
-
- `dim` (atténué)
|
|
199
|
-
- `italic` (italique)
|
|
200
|
-
- `underline` (souligné)
|
|
201
|
-
- `blink` (clignotant)
|
|
202
|
-
- `reverse` (inverse les couleurs)
|
|
203
|
-
- `hidden` (caché)
|
|
204
|
-
- `strikethrough` (barré)
|
|
205
|
-
|
|
206
|
-
## 📝 Exemples
|
|
207
|
-
|
|
208
|
-
### Utilisation de Base
|
|
209
|
-
|
|
210
|
-
```javascript
|
|
211
|
-
import chroma from 'chromalogger/utils/chroma.js';
|
|
212
|
-
|
|
213
|
-
// Texte coloré simple
|
|
214
|
-
chroma('Erreur : Quelque chose a mal tourné !', 'red');
|
|
215
|
-
|
|
216
|
-
// Styles multiples
|
|
217
|
-
chroma('Attention : Ceci est important !', 'yellow', 'bright', 'underline');
|
|
218
|
-
|
|
219
|
-
// Couleur d'arrière-plan
|
|
220
|
-
chroma('Succès !', 'green', 'bgBlack');
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
### Utilisation Avancée
|
|
224
|
-
|
|
225
|
-
```javascript
|
|
226
|
-
// Créer des fonctions de log réutilisables
|
|
227
|
-
const succes = (texte) => chroma(texte, 'green', 'bright');
|
|
228
|
-
const erreur = (texte) => chroma(texte, 'red', 'bright');
|
|
229
|
-
const avertissement = (texte) => chroma(texte, 'yellow', 'bright');
|
|
230
|
-
|
|
231
|
-
// Les utiliser dans votre application
|
|
232
|
-
succes('Opération réussie !');
|
|
233
|
-
erreur('Échec de la connexion au serveur');
|
|
234
|
-
avertissement('Cette fonctionnalité est obsolète');
|
|
235
|
-
|
|
236
|
-
// Style conditionnel
|
|
237
|
-
const statut = 'succes';
|
|
238
|
-
chroma(
|
|
239
|
-
`Statut : ${statut}`,
|
|
240
|
-
statut === 'succes' ? 'green' : 'red',
|
|
241
|
-
'bright'
|
|
242
|
-
);
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
## ⚠️ Notes
|
|
246
|
-
|
|
247
|
-
- Chroma est conçu pour les environnements Node.js avec support de la console
|
|
248
|
-
- Les couleurs peuvent ne pas s'afficher correctement dans tous les terminaux
|
|
249
|
-
- Pour des besoins de journalisation plus complexes, envisagez d'utiliser le module ChromaLogger complet
|
|
250
|
-
|
|
251
|
-
## 📄 Licence
|
|
252
|
-
|
|
253
|
-
MIT - Voir [LICENCE](LICENSE) pour plus d'informations.
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Comment contribuer
|
|
2
|
-
|
|
3
|
-
Merci de votre intérêt pour `logcolor-js` ! Voici comment vous pouvez contribuer au projet.
|
|
4
|
-
|
|
5
|
-
## Signaler un bug
|
|
6
|
-
|
|
7
|
-
Si vous trouvez un bug, merci de créer une issue en suivant ces étapes :
|
|
8
|
-
|
|
9
|
-
1. Vérifiez que le bug n'a pas déjà été signalé
|
|
10
|
-
2. Décrivez le bug de manière claire et concise
|
|
11
|
-
3. Incluez des étapes pour reproduire le bug
|
|
12
|
-
4. Précisez le comportement attendu
|
|
13
|
-
5. Incluez la version de Node.js et du module
|
|
14
|
-
|
|
15
|
-
## Proposer une amélioration
|
|
16
|
-
|
|
17
|
-
1. Créez une issue pour discuter de votre idée
|
|
18
|
-
2. Si l'idée est acceptée, créez une branche pour votre fonctionnalité
|
|
19
|
-
3. Assurez-vous que les tests passent (`npm test`)
|
|
20
|
-
4. Soumettez une pull request
|
|
21
|
-
|
|
22
|
-
## Processus de développement
|
|
23
|
-
|
|
24
|
-
1. Forkez le dépôt
|
|
25
|
-
2. Installez les dépendances : `npm install`
|
|
26
|
-
3. Créez une branche pour votre fonctionnalité : `git checkout -b ma-nouvelle-fonctionnalite`
|
|
27
|
-
4. Faites vos modifications
|
|
28
|
-
5. Lancez les tests : `npm test`
|
|
29
|
-
6. Formatez votre code : `npm run format`
|
|
30
|
-
7. Vérifiez les erreurs de style : `npm run lint`
|
|
31
|
-
8. Poussez vos modifications : `git push origin ma-nouvelle-fonctionnalite`
|
|
32
|
-
9. Créez une Pull Request
|
|
33
|
-
|
|
34
|
-
## Directives de codage
|
|
35
|
-
|
|
36
|
-
- Suivez le style de code existant
|
|
37
|
-
- Écrivez des tests pour les nouvelles fonctionnalités
|
|
38
|
-
- Documentez votre code avec des commentaires clairs
|
|
39
|
-
- Gardez les commits atomiques et bien décrits
|
|
40
|
-
|
|
41
|
-
## Licence
|
|
42
|
-
|
|
43
|
-
En contribuant à ce projet, vous acceptez que vos contributions soient sous la même licence que le projet (MIT).
|