traceperf 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/README.md +50 -87
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -54,43 +54,7 @@ import tracePerf from 'traceperf';
54
54
  tracePerf.info('This is an info message');
55
55
  ```
56
56
 
57
- ## Execution Flow Tracking
58
57
 
59
- ```javascript
60
- function fetchData() {
61
- processData();
62
- }
63
-
64
- function processData() {
65
- calculateResults();
66
- }
67
-
68
- function calculateResults() {
69
- return 'done';
70
- }
71
-
72
- // Track the execution of the fetchData function
73
- const result = tracePerf.track(fetchData);
74
- ```
75
-
76
- Output:
77
-
78
- ```
79
- Execution Flow:
80
- ┌──────────────────────────────┐
81
- │ fetchData │ ⏱ 200ms
82
- └──────────────────────────────┘
83
- │
84
- ▼
85
- ┌──────────────────────────────┐
86
- │ processData │ ⏱ 500ms ⚠️ SLOW
87
- └──────────────────────────────┘
88
- │
89
- ▼
90
- ┌──────────────────────────────┐
91
- │ calculateResults │ ⏱ 300ms
92
- └──────────────────────────────┘
93
- ```
94
58
 
95
59
  ## Conditional Logging Modes
96
60
 
@@ -183,56 +147,6 @@ function DataComponent() {
183
147
  }
184
148
  ```
185
149
 
186
- ## Advanced Configuration
187
-
188
- ```javascript
189
- const { createLogger } = require('traceperf');
190
-
191
- // Create a custom logger instance
192
- const logger = createLogger({
193
- mode: 'dev',
194
- level: 'debug',
195
- colorize: true,
196
- timestamp: true,
197
- performanceThreshold: 100, // ms
198
- indentSize: 2,
199
- });
200
-
201
- // Use the custom logger
202
- logger.info('Custom logger');
203
- ```
204
-
205
- ## API Reference
206
-
207
- ### Logging Methods
208
-
209
- - `info(message, ...args)`: Log an informational message
210
- - `warn(message, ...args)`: Log a warning message
211
- - `error(message, ...args)`: Log an error message
212
- - `debug(message, ...args)`: Log a debug message (filtered in production)
213
-
214
- ### Grouping
215
-
216
- - `group(label)`: Start a new log group with the given label
217
- - `groupEnd()`: End the current log group
218
-
219
- ### Execution Tracking
220
-
221
- - `track(fn, options)`: Track the execution of a function and log performance metrics
222
- - `options.label`: Custom label for the tracked function
223
- - `options.threshold`: Performance threshold in milliseconds
224
- - `options.includeMemory`: Whether to include memory usage tracking
225
- - `options.silent`: Whether to suppress logging for this tracking
226
-
227
- ### Configuration
228
-
229
- - `setMode(mode)`: Set the operational mode ('dev', 'staging', 'prod')
230
- - `getMode()`: Get the current operational mode
231
-
232
- ## License
233
-
234
- MIT
235
-
236
150
  ## Advanced Usage
237
151
 
238
152
  ### Tracking Nested Function Calls
@@ -351,4 +265,53 @@ tracePerf.track(fn, {
351
265
  // ... other options
352
266
  enableNestedTracking: true, // Enable/disable nested tracking
353
267
  });
354
- ```
268
+ ```
269
+
270
+ ```javascript
271
+ const { createLogger } = require('traceperf');
272
+
273
+ // Create a custom logger instance
274
+ const logger = createLogger({
275
+ mode: 'dev',
276
+ level: 'debug',
277
+ colorize: true,
278
+ timestamp: true,
279
+ performanceThreshold: 100, // ms
280
+ indentSize: 2,
281
+ });
282
+
283
+ // Use the custom logger
284
+ logger.info('Custom logger');
285
+ ```
286
+
287
+ ## API Reference
288
+
289
+ ### Logging Methods
290
+
291
+ - `info(message, ...args)`: Log an informational message
292
+ - `warn(message, ...args)`: Log a warning message
293
+ - `error(message, ...args)`: Log an error message
294
+ - `debug(message, ...args)`: Log a debug message (filtered in production)
295
+
296
+ ### Grouping
297
+
298
+ - `group(label)`: Start a new log group with the given label
299
+ - `groupEnd()`: End the current log group
300
+
301
+ ### Execution Tracking
302
+
303
+ - `track(fn, options)`: Track the execution of a function and log performance metrics
304
+ - `options.label`: Custom label for the tracked function
305
+ - `options.threshold`: Performance threshold in milliseconds
306
+ - `options.includeMemory`: Whether to include memory usage tracking
307
+ - `options.silent`: Whether to suppress logging for this tracking
308
+
309
+ ### Configuration
310
+
311
+ - `setMode(mode)`: Set the operational mode ('dev', 'staging', 'prod')
312
+ - `getMode()`: Get the current operational mode
313
+
314
+ ## License
315
+
316
+ MIT
317
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "traceperf",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Advanced console logging & performance tracking for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",