smart-image-scraper-mcp 2.13.1 → 2.13.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.
package/package.json
CHANGED
|
@@ -138,19 +138,17 @@ class Logger {
|
|
|
138
138
|
|
|
139
139
|
const formatted = this._format(level, message, data);
|
|
140
140
|
|
|
141
|
-
// 输出到 stderr(带限流:每秒最多
|
|
142
|
-
if (level >= LogLevel.
|
|
141
|
+
// 输出到 stderr(带限流:每秒最多 5 条 ERROR 级别,防止 stderr 缓冲区堆积阻塞事件循环)
|
|
142
|
+
if (level >= LogLevel.ERROR) {
|
|
143
143
|
const now = Date.now();
|
|
144
144
|
if (now - this._stderrWindowStart > 1000) {
|
|
145
|
-
// 新的1秒窗口
|
|
146
145
|
this._stderrWindowStart = now;
|
|
147
146
|
this._stderrWindowCount = 0;
|
|
148
147
|
}
|
|
149
|
-
if (this._stderrWindowCount <
|
|
148
|
+
if (this._stderrWindowCount < 5) {
|
|
150
149
|
this._stderrWindowCount++;
|
|
151
150
|
process.stderr.write(formatted + '\n');
|
|
152
151
|
}
|
|
153
|
-
// 超出限流的日志静默丢弃,不阻塞
|
|
154
152
|
}
|
|
155
153
|
|
|
156
154
|
// 输出到文件(异步写入,避免阻塞事件循环)
|