easemob-uniapp-logger-plugin 1.4.4 → 1.5.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/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.5.0] - 2026-03-12
9
+
10
+ ### Added
11
+
12
+ - **控制台输出开关**:新增 `enableConsoleOutput` 配置项控制是否输出到控制台
13
+ - 默认值为 `true`,保持向后兼容
14
+ - 支持通过配置 `log.enableConsoleOutput` 在初始化时设置
15
+ - 支持通过 `setConsoleOutput(boolean)` 方法动态开关
16
+ - 支持通过 `getConsoleOutput()` 方法获取当前状态
17
+ - 关闭后日志仍写入本地文件,但不会输出到 hbuilderx 等 IDE 控制台
18
+
8
19
  ## [1.4.2] - 2026-03-11
9
20
 
10
21
  ### Changed
package/README.md CHANGED
@@ -41,6 +41,9 @@ logger.init({
41
41
  conn: EMClient
42
42
  });
43
43
 
44
+ // 如需禁用控制台输出(避免 hbuilderx 等 IDE 控制台日志过多)
45
+ // logger.setConsoleOutput(false);
46
+
44
47
  websdk.logger.onLog = (data) => {
45
48
  console.log('>>>>>SDK输出的日志', data)
46
49
  logger.handleSDKLog(data);
@@ -180,6 +183,7 @@ logger.init(options?: LoggerOptions): void
180
183
  | `expireDays` | `number` | `7` | 日志文件过期天数 |
181
184
  | `maxFileSize` | `number` | `2097152` (2MB) | 单个文件最大大小 |
182
185
  | `uploadTimeout` | `number` | `30000` | 上传超时时间(ms) |
186
+ | `enableConsoleOutput` | `boolean` | `true` | 是否输出到控制台 |
183
187
 
184
188
  ### 记录日志
185
189
 
@@ -233,6 +237,12 @@ const zipPath = await logger.compress();
233
237
  // 设置日志级别
234
238
  logger.setMinLevel('WARN');
235
239
 
240
+ // 设置是否输出到控制台(用于控制 hbuilderx 等 IDE 的控制台输出)
241
+ logger.setConsoleOutput(false);
242
+
243
+ // 获取当前控制台输出状态
244
+ const isEnabled = logger.getConsoleOutput();
245
+
236
246
  // 销毁 logger
237
247
  logger.destroy();
238
248
  ```