@mks2508/better-logger 5.0.0 → 5.0.2

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 (162) hide show
  1. package/dist/chunks/{Logger-Cbi1f10o.js → Logger-CKqzXDh3.js} +2 -2
  2. package/dist/chunks/{Logger-Cbi1f10o.js.map → Logger-CKqzXDh3.js.map} +1 -1
  3. package/dist/chunks/{Logger-BZ7B7OXE.js → Logger-D_vuKP4l.js} +2 -2
  4. package/dist/chunks/{Logger-BZ7B7OXE.js.map → Logger-D_vuKP4l.js.map} +1 -1
  5. package/dist/chunks/cli-module-B-njrTWb.js +2 -0
  6. package/dist/chunks/cli-module-B-njrTWb.js.map +1 -0
  7. package/dist/chunks/{cli-module-ClIJmaT8.js → cli-module-Cx7qotPY.js} +16 -9
  8. package/dist/chunks/cli-module-Cx7qotPY.js.map +1 -0
  9. package/dist/cli.cjs +1 -1
  10. package/dist/cli.js +1 -1
  11. package/dist/exports.cjs +1 -1
  12. package/dist/exports.js +1 -1
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +3 -3
  15. package/dist/styling.cjs +1 -1
  16. package/dist/styling.js +2 -2
  17. package/dist/terminal/formatter.d.ts.map +1 -1
  18. package/package.json +5 -1
  19. package/.claude/settings.local.json +0 -48
  20. package/.github/workflows/ci-quality.yml +0 -357
  21. package/.github/workflows/docs-demo.yml +0 -119
  22. package/.github/workflows/releases-core.yml +0 -512
  23. package/.github/workflows/releases-full.yml +0 -582
  24. package/.github/workflows-backup/ci.yml +0 -221
  25. package/.github/workflows-backup/nightly.yml +0 -196
  26. package/.github/workflows-backup/release-optimized.yml +0 -373
  27. package/.github/workflows-backup/release.yml +0 -269
  28. package/.release-notes-0.2.0.md +0 -129
  29. package/.yamllint +0 -28
  30. package/CHANGELOG.json +0 -1076
  31. package/CHANGELOG.md +0 -209
  32. package/CLAUDE.md +0 -217
  33. package/bun.lock +0 -333
  34. package/demo.html +0 -847
  35. package/dist/chunks/cli-module-CadqgZ1Z.js +0 -2
  36. package/dist/chunks/cli-module-CadqgZ1Z.js.map +0 -1
  37. package/dist/chunks/cli-module-ClIJmaT8.js.map +0 -1
  38. package/docs/API.md +0 -918
  39. package/docs/CORE.md +0 -264
  40. package/docs/DEVELOPMENT.md +0 -731
  41. package/docs/EXPORTS.md +0 -467
  42. package/docs/PACKAGES.md +0 -244
  43. package/docs/STYLING.md +0 -405
  44. package/docs/_config.yml +0 -36
  45. package/docs/index.md +0 -179
  46. package/examples/README.md +0 -208
  47. package/examples/basic-logging.js +0 -75
  48. package/examples/data-export.js +0 -234
  49. package/examples/package.json +0 -16
  50. package/examples/performance-timing.js +0 -170
  51. package/examples/simplified-api.js +0 -124
  52. package/examples/styling-themes.js +0 -207
  53. package/index.html +0 -358
  54. package/packages/core/package.json +0 -57
  55. package/packages/exports/package.json +0 -41
  56. package/packages/nodejs-opentui/README.md +0 -232
  57. package/packages/nodejs-opentui/package.json +0 -72
  58. package/packages/nodejs-opentui/src/LogRenderer.ts +0 -171
  59. package/packages/nodejs-opentui/src/OpenTUILogHandler.ts +0 -178
  60. package/packages/nodejs-opentui/src/components/LogBadge.tsx +0 -131
  61. package/packages/nodejs-opentui/src/index.ts +0 -133
  62. package/packages/nodejs-opentui/src/types.ts +0 -158
  63. package/packages/nodejs-opentui/tsconfig.json +0 -20
  64. package/packages/styling/package.json +0 -41
  65. package/playground/demo-all.ts +0 -95
  66. package/playground/demo-box.ts +0 -85
  67. package/playground/demo-levels.ts +0 -56
  68. package/playground/demo-real-world.ts +0 -98
  69. package/playground/demo-spinner.ts +0 -77
  70. package/playground/demo-steps.ts +0 -72
  71. package/playground/demo-table.ts +0 -83
  72. package/project-utils/README.md +0 -172
  73. package/project-utils/auto-release-gemini.ts +0 -1193
  74. package/project-utils/auto-release-ui.ts +0 -1329
  75. package/project-utils/commit-generator.ts +0 -1385
  76. package/project-utils/commit-ui.ts +0 -264
  77. package/project-utils/git-utils.ts +0 -199
  78. package/project-utils/github-release-manager.ts +0 -466
  79. package/project-utils/project-config.ts +0 -260
  80. package/project-utils/prompt-templates.js +0 -345
  81. package/project-utils/prompt-templates.ts +0 -422
  82. package/project-utils/version-manager.ts +0 -1078
  83. package/public/vite.svg +0 -1
  84. package/src/Logger.ts +0 -1858
  85. package/src/ScopedLogger.ts +0 -256
  86. package/src/cli/CommandProcessor.ts +0 -248
  87. package/src/cli/commands/ConfigCommand.ts +0 -93
  88. package/src/cli/commands/ExportCommand.ts +0 -276
  89. package/src/cli/commands/HistoryCommand.ts +0 -117
  90. package/src/cli/commands/StatusCommand.ts +0 -112
  91. package/src/cli/commands/ThemeCommand.ts +0 -88
  92. package/src/cli/help.ts +0 -127
  93. package/src/cli/index.ts +0 -71
  94. package/src/cli-module.ts +0 -21
  95. package/src/cli-primitives/box.ts +0 -86
  96. package/src/cli-primitives/cli-table.ts +0 -62
  97. package/src/cli-primitives/divider.ts +0 -17
  98. package/src/cli-primitives/header.ts +0 -18
  99. package/src/cli-primitives/index.ts +0 -13
  100. package/src/cli-primitives/server-fallback.ts +0 -54
  101. package/src/cli-primitives/spinner.ts +0 -133
  102. package/src/cli-primitives/step.ts +0 -22
  103. package/src/constants.ts +0 -313
  104. package/src/core.ts +0 -397
  105. package/src/example.ts +0 -210
  106. package/src/exports-module.ts +0 -311
  107. package/src/handlers/AnalyticsLogHandler.ts +0 -22
  108. package/src/handlers/ExportLogHandler.ts +0 -610
  109. package/src/handlers/FileLogHandler.ts +0 -169
  110. package/src/handlers/RemoteLogHandler.ts +0 -42
  111. package/src/handlers/index.ts +0 -8
  112. package/src/hooks/HookManager.ts +0 -177
  113. package/src/hooks/index.ts +0 -1
  114. package/src/index.ts +0 -395
  115. package/src/main.ts +0 -196
  116. package/src/serializers/SerializerRegistry.ts +0 -173
  117. package/src/serializers/index.ts +0 -1
  118. package/src/style.css +0 -96
  119. package/src/styling/LogStyleBuilder.ts +0 -355
  120. package/src/styling/SemanticStyles.ts +0 -380
  121. package/src/styling/SmartPresets.ts +0 -288
  122. package/src/styling/StyleBuilder.ts +0 -319
  123. package/src/styling/StyleCache.ts +0 -131
  124. package/src/styling/banners.ts +0 -168
  125. package/src/styling/index.ts +0 -27
  126. package/src/styling/themes.ts +0 -235
  127. package/src/styling-module.ts +0 -244
  128. package/src/terminal/color-converter.ts +0 -315
  129. package/src/terminal/formatter.ts +0 -236
  130. package/src/terminal/terminal-renderer.ts +0 -342
  131. package/src/transports/ConsoleTransport.ts +0 -28
  132. package/src/transports/FileTransport.ts +0 -53
  133. package/src/transports/HttpTransport.ts +0 -56
  134. package/src/transports/TransportManager.ts +0 -130
  135. package/src/transports/index.ts +0 -4
  136. package/src/types/core.ts +0 -417
  137. package/src/types/handlers.ts +0 -95
  138. package/src/types/hooks.ts +0 -45
  139. package/src/types/index.ts +0 -83
  140. package/src/types/serializers.ts +0 -30
  141. package/src/types/transports.ts +0 -52
  142. package/src/typescript.svg +0 -1
  143. package/src/utils/adapter.ts +0 -291
  144. package/src/utils/ansi-colors.ts +0 -333
  145. package/src/utils/environment-detector.ts +0 -170
  146. package/src/utils/environment.ts +0 -94
  147. package/src/utils/formatting.ts +0 -332
  148. package/src/utils/index.ts +0 -33
  149. package/src/utils/opentui-detection.ts +0 -138
  150. package/src/utils/output.ts +0 -227
  151. package/src/utils/stackTrace.ts +0 -144
  152. package/src/utils/timestamps.ts +0 -80
  153. package/src/vite-env.d.ts +0 -1
  154. package/src/writers/BufferWriter.ts +0 -157
  155. package/src/writers/index.ts +0 -6
  156. package/test-core-browser.html +0 -237
  157. package/test-core-node.js +0 -63
  158. package/tests/test-conflict-resolution.ts +0 -391
  159. package/tests/validate-workflows.sh +0 -131
  160. package/tests/yaml-autofix.sh +0 -146
  161. package/tsconfig.json +0 -50
  162. package/vite.config.ts +0 -256
@@ -1,157 +0,0 @@
1
- /**
2
- * @fileoverview BufferWriter - Collects log output in memory for later use
3
- * @version 4.0.0
4
- */
5
-
6
- import type { LogLevel, OutputWriter } from '../types/core.js';
7
-
8
- /**
9
- * Entry in the log buffer
10
- */
11
- export interface BufferEntry {
12
- message: string;
13
- level: LogLevel;
14
- styles: string[];
15
- timestamp: number;
16
- }
17
-
18
- /**
19
- * BufferWriter collects log messages in memory instead of outputting to console.
20
- * Useful for:
21
- * - CLI operations with spinners (buffer logs during spinner, show after)
22
- * - Testing (capture logs for assertions)
23
- * - Batch processing (collect logs, process together)
24
- *
25
- * @implements {OutputWriter}
26
- * @since 4.0.0
27
- *
28
- * @example
29
- * import logger, { BufferWriter } from '@mks2508/better-logger';
30
- *
31
- * const buffer = new BufferWriter();
32
- * logger.updateConfig({
33
- * outputMode: 'custom',
34
- * outputWriter: buffer
35
- * });
36
- *
37
- * // Logs go to buffer, not console
38
- * spinner.start('Loading...');
39
- * logger.info('Connecting...');
40
- * logger.info('Processing...');
41
- * spinner.stop();
42
- *
43
- * // Show buffered logs
44
- * logger.updateConfig({ outputMode: 'console' });
45
- * buffer.flush(); // Outputs all buffered logs to console
46
- */
47
- export class BufferWriter implements OutputWriter {
48
- private buffer: BufferEntry[] = [];
49
- private maxSize: number;
50
-
51
- /**
52
- * Creates a new BufferWriter
53
- * @param maxSize - Maximum number of entries to buffer (default: 1000)
54
- */
55
- constructor(maxSize: number = 1000) {
56
- this.maxSize = maxSize;
57
- }
58
-
59
- /**
60
- * Writes a log entry to the buffer
61
- * @param message - Formatted log message
62
- * @param level - Log level
63
- * @param styles - CSS styles (for browser console)
64
- */
65
- write(message: string, level: LogLevel, styles: string[]): void {
66
- if (this.buffer.length >= this.maxSize) {
67
- this.buffer.shift(); // Remove oldest entry
68
- }
69
-
70
- this.buffer.push({
71
- message,
72
- level,
73
- styles,
74
- timestamp: Date.now()
75
- });
76
- }
77
-
78
- /**
79
- * Returns all buffered entries
80
- * @returns Copy of the buffer array
81
- */
82
- getBuffer(): BufferEntry[] {
83
- return [...this.buffer];
84
- }
85
-
86
- /**
87
- * Returns buffered entries filtered by log level
88
- * @param levels - Log levels to include
89
- * @returns Filtered buffer entries
90
- */
91
- getByLevel(...levels: LogLevel[]): BufferEntry[] {
92
- return this.buffer.filter(entry => levels.includes(entry.level));
93
- }
94
-
95
- /**
96
- * Returns the number of buffered entries
97
- */
98
- get size(): number {
99
- return this.buffer.length;
100
- }
101
-
102
- /**
103
- * Checks if buffer is empty
104
- */
105
- get isEmpty(): boolean {
106
- return this.buffer.length === 0;
107
- }
108
-
109
- /**
110
- * Clears all buffered entries
111
- */
112
- clear(): void {
113
- this.buffer = [];
114
- }
115
-
116
- /**
117
- * Outputs all buffered entries to console and clears the buffer
118
- */
119
- flush(): void {
120
- this.buffer.forEach(entry => {
121
- if (entry.styles.length > 0) {
122
- console.log(entry.message, ...entry.styles);
123
- } else {
124
- console.log(entry.message);
125
- }
126
- });
127
- this.clear();
128
- }
129
-
130
- /**
131
- * Outputs buffered entries to console without clearing
132
- */
133
- replay(): void {
134
- this.buffer.forEach(entry => {
135
- if (entry.styles.length > 0) {
136
- console.log(entry.message, ...entry.styles);
137
- } else {
138
- console.log(entry.message);
139
- }
140
- });
141
- }
142
-
143
- /**
144
- * Returns all messages as an array of strings
145
- */
146
- toArray(): string[] {
147
- return this.buffer.map(entry => entry.message);
148
- }
149
-
150
- /**
151
- * Returns all messages joined as a single string
152
- * @param separator - String to join messages with (default: newline)
153
- */
154
- toString(separator: string = '\n'): string {
155
- return this.toArray().join(separator);
156
- }
157
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * @fileoverview Output writers for better-logger
3
- * @version 4.0.0
4
- */
5
-
6
- export { BufferWriter, type BufferEntry } from './BufferWriter.js';
@@ -1,237 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Core Logger Browser Test</title>
7
- <style>
8
- body {
9
- font-family: system-ui, sans-serif;
10
- max-width: 800px;
11
- margin: 0 auto;
12
- padding: 20px;
13
- background-color: #f5f5f5;
14
- }
15
- .test-section {
16
- background: white;
17
- margin: 20px 0;
18
- padding: 20px;
19
- border-radius: 8px;
20
- box-shadow: 0 2px 4px rgba(0,0,0,0.1);
21
- }
22
- button {
23
- background: #007bff;
24
- color: white;
25
- border: none;
26
- padding: 10px 20px;
27
- margin: 5px;
28
- border-radius: 4px;
29
- cursor: pointer;
30
- }
31
- button:hover { background: #0056b3; }
32
- .console-note {
33
- background: #e9ecef;
34
- padding: 10px;
35
- border-left: 4px solid #007bff;
36
- margin: 10px 0;
37
- }
38
- .success { color: #28a745; font-weight: bold; }
39
- .error { color: #dc3545; font-weight: bold; }
40
- </style>
41
- </head>
42
- <body>
43
- <h1>🧪 Core Logger Browser Test</h1>
44
-
45
- <div class="console-note">
46
- <strong>📋 Instructions:</strong> Open your browser's Developer Console (F12) to see the log output.
47
- All tests will show styled output in browser console with CSS formatting.
48
- </div>
49
-
50
- <div class="test-section">
51
- <h2>Environment Detection</h2>
52
- <button onclick="testEnvironment()">Test Environment Detection</button>
53
- <div id="env-info"></div>
54
- </div>
55
-
56
- <div class="test-section">
57
- <h2>Basic Logging</h2>
58
- <button onclick="testBasicLogging()">Test Basic Levels</button>
59
- <p>Check console for styled output with gradients and colors.</p>
60
- </div>
61
-
62
- <div class="test-section">
63
- <h2>Scoped Logger</h2>
64
- <button onclick="testScopedLogger()">Test Scoped Logging</button>
65
- <p>Should show prefixed messages in console.</p>
66
- </div>
67
-
68
- <div class="test-section">
69
- <h2>Advanced Features</h2>
70
- <button onclick="testAdvancedFeatures()">Test Tables & Groups</button>
71
- <p>Should use native browser console.table() and grouping.</p>
72
- </div>
73
-
74
- <div class="test-section">
75
- <h2>Performance Timers</h2>
76
- <button onclick="testTimers()">Test Timers</button>
77
- <p>Should measure and log execution time.</p>
78
- </div>
79
-
80
- <div class="test-section">
81
- <h2>Custom Handlers</h2>
82
- <button onclick="testHandlers()">Test Custom Handler</button>
83
- <p>Should trigger custom handler alongside console output.</p>
84
- </div>
85
-
86
- <div class="test-section">
87
- <h2>Results</h2>
88
- <div id="results"></div>
89
- </div>
90
-
91
- <script type="module">
92
- // Import the core logger
93
- import logger from './packages/core/dist/index.js';
94
-
95
- // Make logger available globally for tests
96
- window.logger = logger;
97
- window.testResults = [];
98
-
99
- // Test functions
100
- window.testEnvironment = function() {
101
- console.log('=== Environment Detection Test ===');
102
-
103
- const info = {
104
- userAgent: navigator.userAgent,
105
- platform: navigator.platform,
106
- language: navigator.language,
107
- cookiesEnabled: navigator.cookieEnabled,
108
- onLine: navigator.onLine,
109
- colorScheme: window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
110
- };
111
-
112
- logger.info('Browser environment detected');
113
- logger.info('User Agent: ' + info.userAgent);
114
- logger.info('Platform: ' + info.platform);
115
- logger.info('Color Scheme: ' + info.colorScheme);
116
-
117
- document.getElementById('env-info').innerHTML = `
118
- <p><strong>Platform:</strong> ${info.platform}</p>
119
- <p><strong>Color Scheme:</strong> ${info.colorScheme}</p>
120
- <p class="success">✅ Environment detection working</p>
121
- `;
122
-
123
- window.testResults.push('Environment: ✅ Passed');
124
- updateResults();
125
- };
126
-
127
- window.testBasicLogging = function() {
128
- console.log('=== Basic Logging Test ===');
129
-
130
- logger.debug('Debug message - should be styled with gray gradient');
131
- logger.info('Info message - should be styled with blue gradient');
132
- logger.warn('Warning message - should be styled with yellow gradient');
133
- logger.error('Error message - should be styled with red gradient');
134
- logger.critical('Critical message - should be styled with dark red gradient');
135
-
136
- console.log('Check above for styled console output with gradients and colors');
137
- window.testResults.push('Basic Logging: ✅ Passed');
138
- updateResults();
139
- };
140
-
141
- window.testScopedLogger = function() {
142
- console.log('=== Scoped Logger Test ===');
143
-
144
- const apiLogger = logger.scope('API');
145
- const dbLogger = logger.scope('DATABASE');
146
-
147
- apiLogger.info('API request started');
148
- apiLogger.warn('API rate limit warning');
149
- apiLogger.error('API request failed');
150
-
151
- dbLogger.info('Database connection established');
152
- dbLogger.warn('Slow query detected');
153
-
154
- window.testResults.push('Scoped Logging: ✅ Passed');
155
- updateResults();
156
- };
157
-
158
- window.testAdvancedFeatures = function() {
159
- console.log('=== Advanced Features Test ===');
160
-
161
- // Test table
162
- const sampleData = [
163
- { name: 'Alice', age: 25, role: 'Developer' },
164
- { name: 'Bob', age: 30, role: 'Designer' },
165
- { name: 'Carol', age: 28, role: 'Manager' }
166
- ];
167
-
168
- logger.table(sampleData);
169
-
170
- // Test groups
171
- logger.group('Database Operations');
172
- logger.info('Connecting to database');
173
- logger.info('Executing complex query');
174
- logger.group('Transaction Details', true); // collapsed
175
- logger.info('Transaction started');
176
- logger.info('Updating records');
177
- logger.groupEnd();
178
- logger.info('Transaction completed');
179
- logger.groupEnd();
180
-
181
- window.testResults.push('Advanced Features: ✅ Passed');
182
- updateResults();
183
- };
184
-
185
- window.testTimers = function() {
186
- console.log('=== Performance Timers Test ===');
187
-
188
- logger.time('operation-1');
189
- logger.time('operation-2');
190
-
191
- setTimeout(() => {
192
- logger.timeEnd('operation-1');
193
-
194
- setTimeout(() => {
195
- logger.timeEnd('operation-2');
196
- window.testResults.push('Timers: ✅ Passed');
197
- updateResults();
198
- }, 150);
199
- }, 100);
200
- };
201
-
202
- window.testHandlers = function() {
203
- console.log('=== Custom Handlers Test ===');
204
-
205
- let handlerCalled = false;
206
- const testHandler = {
207
- handle: (level, message, args, metadata) => {
208
- console.log('🔧 Custom handler received:', { level, message, timestamp: metadata.timestamp });
209
- handlerCalled = true;
210
- }
211
- };
212
-
213
- logger.addHandler(testHandler);
214
- logger.info('This message should trigger the custom handler');
215
-
216
- setTimeout(() => {
217
- if (handlerCalled) {
218
- window.testResults.push('Custom Handlers: ✅ Passed');
219
- } else {
220
- window.testResults.push('Custom Handlers: ❌ Failed');
221
- }
222
- updateResults();
223
- }, 50);
224
- };
225
-
226
- function updateResults() {
227
- const resultsDiv = document.getElementById('results');
228
- resultsDiv.innerHTML = '<h3>Test Results:</h3>' +
229
- window.testResults.map(result => `<p>${result}</p>`).join('');
230
- }
231
-
232
- // Auto-run environment test
233
- console.log('🚀 Core Logger Browser Test Started');
234
- console.log('📍 Check console output for styled logs with CSS gradients');
235
- </script>
236
- </body>
237
- </html>
package/test-core-node.js DELETED
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Test script for core logger in Node.js environment
5
- */
6
- console.log('=== Testing Core Logger in Node.js ===\n');
7
-
8
- // Test ES module import
9
- import logger from './packages/core/dist/index.js';
10
-
11
- console.log('Environment detection:');
12
- console.log('- Runtime:', process.versions.node ? 'Node.js' : 'Unknown');
13
- console.log('- Colors supported:', process.stdout.isTTY);
14
- console.log('- File system available:', 'Yes (Node.js)');
15
- console.log();
16
-
17
- console.log('Testing basic logging:');
18
- logger.info('Hello from Node.js!');
19
- logger.warn('This is a warning message');
20
- logger.error('This is an error message');
21
- logger.critical('This should work in Node.js (critical level)');
22
- console.log();
23
-
24
- console.log('Testing scoped logger:');
25
- const apiLogger = logger.scope('API');
26
- apiLogger.info('API request started');
27
- apiLogger.error('API request failed');
28
- console.log();
29
-
30
- console.log('Testing timers:');
31
- logger.time('test-operation');
32
- setTimeout(() => {
33
- logger.timeEnd('test-operation');
34
- console.log();
35
-
36
- console.log('Testing table (Node.js plain text):');
37
- const data = [
38
- { name: 'Alice', age: 25, role: 'Developer' },
39
- { name: 'Bob', age: 30, role: 'Designer' },
40
- { name: 'Carol', age: 28, role: 'Manager' }
41
- ];
42
- logger.table(data);
43
- console.log();
44
-
45
- console.log('Testing groups:');
46
- logger.group('Database Operations');
47
- logger.info('Connecting to database');
48
- logger.info('Executing query');
49
- logger.groupEnd();
50
- console.log();
51
-
52
- console.log('Testing custom handler (mock):');
53
- const mockHandler = {
54
- handle: (level, message, args, metadata) => {
55
- console.log(`Custom handler received: [${level.toUpperCase()}] ${message}`);
56
- }
57
- };
58
- logger.addHandler(mockHandler);
59
- logger.info('This should trigger custom handler');
60
- console.log();
61
-
62
- console.log('✅ Node.js tests completed successfully!');
63
- }, 100);