Skip to content

Commit 5ddd0f3

Browse files
authored
Merge pull request #4 from instructa/fix/file-logging-respect-stack-mode
Fix: File logging now respects stackMode option
2 parents 6ce9221 + 9ae0919 commit 5ddd0f3

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [1.0.2] - 2025-09-XX
9+
10+
### Fixed
11+
- **File Logging Stack Mode**: Fixed file logging to properly respect `stackMode` configuration, ensuring that both `full` and `condensed` stack modes work correctly when writing logs to files
12+
- **Stack Trace Formatting**: Enhanced stack logging in middleware to properly format stack traces according to the configured stack mode
13+
14+
## [1.0.1] - 2025-08-24
15+
16+
### Changed
17+
- **Configuration System**: Migrated from `.browser-echo-mcp.json` to `.cursor/mcp.json` for better Cursor IDE integration and cleaner project setup
18+
- **MCP Server Configuration**: Updated MCP server configuration to use the new Cursor-native format for improved developer experience
19+
20+
### Fixed
21+
- **Workspace Dependencies**: Fixed workspace dependency versioning to ensure proper publishing of packages with correct version references
22+
23+
## [1.0.0] - 2025-08-XX
24+
25+
### Added
26+
- Initial release of Browser Echo MCP
27+
- Support for streaming browser console logs to development terminals and AI assistants
28+
- Framework support for React, Vue, Nuxt 3/4, Next.js, TanStack Start, and Vite-based frameworks
29+
- MCP (Model Context Protocol) server for AI assistant integration
30+
- Optional file logging with configurable stack trace modes
31+
- Colorized terminal output
32+
- Source hints with file:line:col information
33+
- Batched log transmission using `sendBeacon` when available

packages/vite/src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,12 @@ function attachMiddleware(server: any, options: ResolvedOptions) {
223223
if (options.fileLog.enabled) {
224224
const time = new Date().toISOString();
225225
const toFile = [`[${time}] ${line}`];
226-
if (entry.stack && options.stackMode !== 'none') toFile.push(indent(entry.stack, ' '));
226+
if (entry.stack && options.stackMode !== 'none') {
227+
const stackLines = options.stackMode === 'full'
228+
? indent(entry.stack, ' ')
229+
: ` ${(String(entry.stack).split(/\r?\n/g).find((l) => l.trim().length > 0) || '').trim()}`;
230+
toFile.push(stackLines);
231+
}
227232
try { appendFileSync(logFilePath, toFile.join('\n') + '\n'); } catch {}
228233
}
229234
}

0 commit comments

Comments
 (0)