@qubit-ltd/logging 1.4.5 → 1.4.7

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.
@@ -51,63 +51,80 @@
51
51
  <article><h1>js-logging</h1>
52
52
  <p><a href="https://npmjs.com/package/@qubit-ltd/logging"><img src="https://img.shields.io/npm/v/@qubit-ltd/logging.svg" alt="npm package"></a>
53
53
  <a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/badge/License-Apache-blue.svg" alt="License"></a>
54
- <a href="README.zh_CN.md"><img src="https://img.shields.io/badge/%E6%96%87%E6%A1%A3-%E4%B8%AD%E6%96%87%E7%89%88-blue.svg" alt="中文文档"></a>
54
+ <a href="README.md"><img src="https://img.shields.io/badge/Document-English-blue.svg" alt="English Document"></a>
55
55
  <a href="https://dl.circleci.com/status-badge/redirect/gh/Haixing-Hu/js-logging/tree/master"><img src="https://dl.circleci.com/status-badge/img/gh/Haixing-Hu/js-logging/tree/master.svg?style=shield" alt="CircleCI"></a>
56
56
  <a href="https://coveralls.io/github/Haixing-Hu/js-logging?branch=master"><img src="https://coveralls.io/repos/github/Haixing-Hu/js-logging/badge.svg?branch=master" alt="Coverage Status"></a></p>
57
- <p><a href="https://npmjs.com/package/@qubit-ltd/logging">@qubit-ltd/logging</a> is a JavaScript library that provides powerful
58
- logging capabilities through decorators for class methods and properties.
59
- This library is designed to seamlessly integrate with <a href="https://github.com/Haixing-Hu/vue3-class-component/">Vue.js class components</a>,
60
- offering an elegant solution for handling logging in your JavaScript projects.</p>
61
- <h2>Installation</h2>
62
- <p>To install the library, use either npm or yarn:</p>
57
+ <p><a href="https://npmjs.com/package/@qubit-ltd/logging">@qubit-ltd/logging</a> 是一个 JavaScript 库,通过装饰器为类方法和属性提供强大的日志记录功能。
58
+ 该库旨在与<a href="https://github.com/Haixing-Hu/vue3-class-component/">Vue.js 类组件</a>无缝集成,为处理 JavaScript 项目中的日志记录提供了优雅的解决方案。</p>
59
+ <h2>特性</h2>
60
+ <ul>
61
+ <li>📝 简单灵活的日志接口,支持不同的日志级别</li>
62
+ <li>🔍 支持带占位符的格式化日志消息</li>
63
+ <li>🎯 自动方法日志记录和类日志集成的装饰器</li>
64
+ <li>🔄 与Vue.js类组件无缝集成</li>
65
+ <li>🎛️ 可配置的日志级别和输出器</li>
66
+ <li>🌐 全局和单独的日志记录器管理</li>
67
+ <li>📋 支持浏览器控制台和自定义输出器</li>
68
+ </ul>
69
+ <h2>安装</h2>
70
+ <p>使用 npm 或 yarn 安装该库:</p>
63
71
  <pre class="prettyprint source lang-sh"><code>npm install @qubit-ltd/logging
64
72
  </code></pre>
65
- <p>or</p>
73
+ <p>或</p>
66
74
  <pre class="prettyprint source lang-sh"><code>yarn add @qubit-ltd/logging
67
75
  </code></pre>
68
- <h2>The <code>Logger</code> Class</h2>
69
- <p>The <code>Logger</code> class provides a simple yet flexible logging interface.</p>
70
- <h3>Get or create a Logger</h3>
71
- <p>You can retrieve a <code>Logger</code> instance by calling the static method
72
- <code>Logger.getLogger(name, options)</code>, where</p>
76
+ <h2><code>Logger</code> 类</h2>
77
+ <p><code>Logger</code> 类提供了一个简单而灵活的日志记录接口。</p>
78
+ <h3>获取或创建 Logger</h3>
79
+ <p>你可以通过调用静态方法 <code>Logger.getLogger(name, options)</code> 获取一个 <code>Logger</code> 实例,其中:</p>
73
80
  <ul>
74
- <li><code>name</code> is the identifier of the logger. If a logger with the same name exists,
75
- it will be returned; otherwise, a new one will be created.</li>
76
- <li><code>options</code> (optional) is an object that may include:
81
+ <li><code>name</code> logger 的标识符。如果已经存在具有相同名称的 logger,则返回该实例;否则将创建一个新的 logger。</li>
82
+ <li><code>options</code>(可选)是一个对象,可能包括:
77
83
  <ul>
78
- <li><code>appender: object</code>: specifies the output destination for log messages.
79
- This object must implement <code>trace</code>, <code>debug</code>, <code>info</code>, <code>warn</code> and <code>error</code>
80
- methods. If omitted, the existing appender of the logger will be used, or
81
- the default appender will be assigned to a new logger.</li>
82
- <li><code>level: string</code>: defines the logging level (<code>TRACE</code>, <code>DEBUG</code>, <code>INFO</code>, <code>WARN</code>,
83
- <code>ERROR</code>, <code>NONE</code>). Case-insensitive. If omitted, the existing logging level
84
- of the logger will be used, or the default logging level will be assigned to
85
- a new logger.</li>
84
+ <li><code>appender: object</code>:指定日志消息的输出目的地。此对象必须实现 <code>trace</code>、<code>debug</code>、<code>info</code>、<code>warn</code> <code>error</code> 方法。
85
+ 如果省略,将使用 logger 的现有 appender,或者为新创建的 logger 分配默认 appender。</li>
86
+ <li><code>level: string</code>:定义日志记录级别(<code>TRACE</code>、<code>DEBUG</code>、<code>INFO</code>、<code>WARN</code>、<code>ERROR</code>、<code>NONE</code>)。不区分大小写。
87
+ 如果省略,将使用 logger 的现有日志级别,或者为新创建的 logger 分配默认日志级别。</li>
86
88
  </ul>
87
89
  </li>
88
90
  </ul>
89
- <h3>Logging Messages</h3>
91
+ <p>示例:</p>
92
+ <pre class="prettyprint source lang-javascript"><code>import Logger from '@qubit-ltd/logging';
93
+
94
+ // 创建一个使用默认设置的logger
95
+ const logger1 = Logger.getLogger('MyLogger');
96
+
97
+ // 创建一个自定义日志级别的logger
98
+ const logger2 = Logger.getLogger('DebugLogger', { level: 'DEBUG' });
99
+
100
+ // 创建一个带自定义输出器的logger
101
+ const customAppender = {
102
+ trace: (message, ...args) => { /* 自定义trace实现 */ },
103
+ debug: (message, ...args) => { /* 自定义debug实现 */ },
104
+ info: (message, ...args) => { /* 自定义info实现 */ },
105
+ warn: (message, ...args) => { /* 自定义warn实现 */ },
106
+ error: (message, ...args) => { /* 自定义error实现 */ },
107
+ };
108
+ const logger3 = Logger.getLogger('CustomLogger', { appender: customAppender, level: 'INFO' });
109
+ </code></pre>
110
+ <h3>记录日志消息</h3>
90
111
  <ul>
91
- <li><code>logger.trace(message, ...args)</code>: Logs a trace-level message.</li>
92
- <li><code>logger.debug(message, ...args)</code>: Logs a debug-level message.</li>
93
- <li><code>logger.info(message, ...args)</code>: Logs an info-level message.</li>
94
- <li><code>logger.warn(message, ...args)</code>: Logs a warning-level message.</li>
95
- <li><code>logger.error(message, ...args)</code>: Logs an error-level message.</li>
96
- <li><code>logger.log(level, message, ...args)</code>: Logs a message in the specified logging level.</li>
112
+ <li><code>logger.trace(message, ...args)</code>:记录一个 trace 级别的消息。</li>
113
+ <li><code>logger.debug(message, ...args)</code>:记录一个 debug 级别的消息。</li>
114
+ <li><code>logger.info(message, ...args)</code>:记录一个 info 级别的消息。</li>
115
+ <li><code>logger.warn(message, ...args)</code>:记录一个警告级别的消息。</li>
116
+ <li><code>logger.error(message, ...args)</code>:记录一个错误级别的消息。</li>
117
+ <li><code>logger.log(level, message, ...args)</code>:以指定的日志级别记录消息。</li>
97
118
  </ul>
98
- <p>You can use placeholders in log messages to dynamically insert variables:</p>
119
+ <p>你可以在日志消息中使用占位符动态插入变量:</p>
99
120
  <ul>
100
- <li><code>%o</code> or <code>%O</code>: JavaScript object output. Clicking the object name opens
101
- more information about it in the inspector.</li>
102
- <li><code>%d</code> or<code> %i</code>: Integer output (supports formatting). For example,
103
- <code>logger.info('Foo %.2d', 1.1)</code> will output the number as two significant
104
- figures with a leading 0: <code>Foo 01</code>.</li>
105
- <li><code>%s</code>: String output.</li>
106
- <li><code>%f</code>: Floating-point number output (supports formatting). For example,
107
- <code>logger.debug(&quot;Foo %.2f&quot;, 1.1)</code> will output the number to 2 decimal
108
- places: <code>Foo 1.10</code>.</li>
121
+ <li><code>%o</code> <code>%O</code>:JavaScript 对象输出。点击对象名称可以在检查器中查看更多信息。</li>
122
+ <li><code>%d</code> <code>%i</code>:整数输出(支持格式化)。例如,<code>logger.info('Foo %.2d', 1.1)</code> 将数字输出为两位有效数字并带有前导0:
123
+ <code>Foo 01</code>。</li>
124
+ <li><code>%s</code>:字符串输出。</li>
125
+ <li><code>%f</code>:浮点数输出(支持格式化)。例如,<code>logger.debug(&quot;Foo %.2f&quot;, 1.1)</code> 将数字输出为两位小数:<code>Foo 1.10</code>。</li>
109
126
  </ul>
110
- <p>Example:</p>
127
+ <p>示例:</p>
111
128
  <pre class="prettyprint source lang-javascript"><code>import Logger from '@qubit-ltd/logging';
112
129
 
113
130
  const logger = Logger.getLogger('MyClass');
@@ -119,11 +136,35 @@ logger.error('This is an error message with argument %s and argument %o', 'foo',
119
136
  const level = 'info';
120
137
  logger.log(level, 'This is an %s message with argument %s and argument %o', level, 'foo', { bar: 'baz' });
121
138
  </code></pre>
122
- <h3>Set the Logging Level</h3>
123
- <p>Adjust the logging level for a logger using <code>logger.setLevel(level)</code>.</p>
124
- <p>Available levels: <code>TRACE</code>, <code>DEBUG</code>, <code>INFO</code>, <code>WARN</code>, <code>ERROR</code>, <code>NONE</code> (case-insensitive).</p>
125
- <h3>Set the Logging Appender</h3>
126
- <p>Use <code>logger.setAppender(appender)</code> to assign a custom appender object that defines:</p>
139
+ <h3>设置日志级别</h3>
140
+ <p>使用 <code>logger.setLevel(level)</code> 调整 logger 的日志级别。</p>
141
+ <p>可用的日志级别(从最详细到最简略):</p>
142
+ <ul>
143
+ <li><code>TRACE</code>:用于调试目的的最详细信息</li>
144
+ <li><code>DEBUG</code>:一般调试信息</li>
145
+ <li><code>INFO</code>:关于应用程序进度的一般信息</li>
146
+ <li><code>WARN</code>:可能需要注意的警告情况</li>
147
+ <li><code>ERROR</code>:需要处理的错误条件</li>
148
+ <li><code>NONE</code>:完全禁用日志记录</li>
149
+ </ul>
150
+ <p>所有级别名称不区分大小写。</p>
151
+ <p>示例:</p>
152
+ <pre class="prettyprint source lang-javascript"><code>const logger = Logger.getLogger('MyClass');
153
+
154
+ // 将级别更改为只显示警告和错误
155
+ logger.setLevel('WARN');
156
+
157
+ // 这些不会显示,因为它们低于WARN级别
158
+ logger.trace('这条跟踪消息不会显示');
159
+ logger.debug('这条调试消息不会显示');
160
+ logger.info('这条信息消息不会显示');
161
+
162
+ // 这些会显示
163
+ logger.warn('这条警告消息会显示');
164
+ logger.error('这条错误消息会显示');
165
+ </code></pre>
166
+ <h3>设置日志 Appender</h3>
167
+ <p>使用 <code>logger.setAppender(appender)</code> 为 logger 分配一个自定义的 appender 对象,该对象定义了以下方法:</p>
127
168
  <ul>
128
169
  <li><code>trace(message, ...args)</code></li>
129
170
  <li><code>debug(message, ...args)</code></li>
@@ -131,83 +172,180 @@ logger.log(level, 'This is an %s message with argument %s and argument %o', leve
131
172
  <li><code>warn(message, ...args)</code></li>
132
173
  <li><code>error(message, ...args)</code></li>
133
174
  </ul>
134
- <p>Example:</p>
175
+ <p>示例:</p>
135
176
  <pre class="prettyprint source lang-javascript"><code>const logger = Logger.getLogger('MyClass');
136
- logger.setAppender(console); // Outputs log messages to the console.
177
+ logger.setAppender(console); // 将日志消息输出到控制台
178
+
179
+ // 或者创建一个为所有日志添加时间戳的自定义输出器
180
+ const timestampAppender = {
181
+ trace: (message, ...args) => console.trace(`[${new Date().toISOString()}] ${message}`, ...args),
182
+ debug: (message, ...args) => console.debug(`[${new Date().toISOString()}] ${message}`, ...args),
183
+ info: (message, ...args) => console.info(`[${new Date().toISOString()}] ${message}`, ...args),
184
+ warn: (message, ...args) => console.warn(`[${new Date().toISOString()}] ${message}`, ...args),
185
+ error: (message, ...args) => console.error(`[${new Date().toISOString()}] ${message}`, ...args),
186
+ };
187
+ logger.setAppender(timestampAppender);
137
188
  </code></pre>
138
- <h3>Enable or Disable Logging</h3>
189
+ <h3>启用或禁用日志记录</h3>
139
190
  <ul>
140
- <li><code>logger.enable()</code>: Enable logging.</li>
141
- <li><code>logger.disable()</code>: Disable logging.</li>
142
- <li><code>logger.setEnabled(enabled)</code>: Dynamically control logging.</li>
191
+ <li><code>logger.enable()</code>:启用日志记录。</li>
192
+ <li><code>logger.disable()</code>:禁用日志记录。</li>
193
+ <li><code>logger.setEnabled(enabled)</code>:动态控制日志记录的启用与禁用。</li>
143
194
  </ul>
144
- <h3>Managing Loggers</h3>
195
+ <p>示例:</p>
196
+ <pre class="prettyprint source lang-javascript"><code>const logger = Logger.getLogger('MyClass');
197
+
198
+ // 暂时禁用所有日志
199
+ logger.disable();
200
+ logger.info('此消息不会被记录');
201
+
202
+ // 重新启用日志
203
+ logger.enable();
204
+ logger.info('此消息会被记录');
205
+
206
+ // 使用条件控制日志记录
207
+ const debugMode = process.env.NODE_ENV === 'development';
208
+ logger.setEnabled(debugMode);
209
+ </code></pre>
210
+ <h3>管理日志记录器</h3>
145
211
  <ul>
146
- <li><code>Logger.clearAllLoggers()</code>: Clears all registered loggers.</li>
147
- <li><code>Logger.getLevel(name)</code>: Retrieves the logging level for a specific logger.</li>
148
- <li><code>Logger.setLevel(name, level)</code>: Sets the logging level for a specific logger.</li>
212
+ <li><code>Logger.clearAllLoggers()</code>:清除所有已注册的日志记录器。</li>
213
+ <li><code>Logger.getLevel(name)</code>:获取特定日志记录器的日志级别。</li>
214
+ <li><code>Logger.setLevel(name, level)</code>:设置特定日志记录器的日志级别。</li>
149
215
  </ul>
150
- <h3>Default Levels and Appenders</h3>
151
- <p>The default logging levels and appenders are used when creating a new logger
152
- without specifying the level or appender.</p>
216
+ <p>示例:</p>
217
+ <pre class="prettyprint source lang-javascript"><code>// 创建多个日志记录器
218
+ const apiLogger = Logger.getLogger('API');
219
+ const uiLogger = Logger.getLogger('UI');
220
+ const dbLogger = Logger.getLogger('Database');
221
+
222
+ // 在不访问实例的情况下更改特定日志记录器的级别
223
+ Logger.setLevel('API', 'DEBUG');
224
+ Logger.setLevel('Database', 'ERROR');
225
+
226
+ // 获取日志记录器的当前级别
227
+ const uiLevel = Logger.getLevel('UI');
228
+ console.log(`UI Logger级别: ${uiLevel}`);
229
+
230
+ // 关闭应用程序时清除所有日志记录器
231
+ Logger.clearAllLoggers();
232
+ </code></pre>
233
+ <h3>默认级别和 Appender</h3>
234
+ <p>当创建一个新日志记录器时,如果没有指定级别或 appender,将使用默认的日志级别和 appender。</p>
153
235
  <ul>
154
- <li><code>Logger.getDefaultLevel()</code>: Gets the default logging level.</li>
155
- <li><code>Logger.setDefaultLevel(level)</code>: Sets the default logging level.</li>
156
- <li><code>Logger.resetDefaultLevel()</code>: Resets the default logging level to the
157
- factory value.</li>
158
- <li><code>Logger.getDefaultAppender()</code>: Gets the default logging appender.</li>
159
- <li><code>Logger.setDefaultAppender(appender)</code>: Sets the default logging appender.</li>
160
- <li><code>Logger.resetDefaultAppender()</code>: Resets the default logging appender to the
161
- factory value.</li>
236
+ <li><code>Logger.getDefaultLevel()</code>:获取默认日志级别。</li>
237
+ <li><code>Logger.setDefaultLevel(level)</code>:设置默认日志级别。</li>
238
+ <li><code>Logger.resetDefaultLevel()</code>:将默认日志级别重置为出厂值。</li>
239
+ <li><code>Logger.getDefaultAppender()</code>:获取默认日志 appender。</li>
240
+ <li><code>Logger.setDefaultAppender(appender)</code>:设置默认日志 appender。</li>
241
+ <li><code>Logger.resetDefaultAppender()</code>:将默认日志 appender 重置为出厂值。</li>
162
242
  </ul>
163
- <h3>Global Loggers Management</h3>
243
+ <p>示例:</p>
244
+ <pre class="prettyprint source lang-javascript"><code>// 获取当前默认级别
245
+ const defaultLevel = Logger.getDefaultLevel();
246
+ console.log(`默认日志级别: ${defaultLevel}`);
247
+
248
+ // 为所有新的日志记录器更改默认级别
249
+ Logger.setDefaultLevel('DEBUG');
250
+
251
+ // 所有新的日志记录器现在默认将具有DEBUG级别
252
+ const logger = Logger.getLogger('NewLogger'); // 将具有DEBUG级别
253
+
254
+ // 重置为原始的工厂默认级别
255
+ Logger.resetDefaultLevel();
256
+ </code></pre>
257
+ <h3>全局日志管理</h3>
164
258
  <ul>
165
- <li><code>Logger.setAllLevels(level)</code>: Applies a logging level to all existing loggers.</li>
166
- <li><code>Logger.resetAllLevels()</code>: Resets the logging level of all existing loggers to
167
- the default logging level.</li>
168
- <li><code>Logger.setAllAppenders(appender)</code>: Applies a logging appender to all existing
169
- loggers.</li>
170
- <li><code>Logger.resetAllAppenders()</code>: Resets the logging appender of all existing loggers
171
- to the default logging appender.</li>
259
+ <li><code>Logger.setAllLevels(level)</code>:将指定日志级别应用于所有现有日志记录器。</li>
260
+ <li><code>Logger.resetAllLevels()</code>:将所有现有日志记录器的日志级别重置为默认日志级别。</li>
261
+ <li><code>Logger.setAllAppenders(appender)</code>:将指定日志 appender 应用于所有现有日志记录器。</li>
262
+ <li><code>Logger.resetAllAppenders()</code>:将所有现有日志记录器的日志 appender 重置为默认 appender。</li>
172
263
  </ul>
173
- <h3>Reset to Factory Defaults</h3>
264
+ <p>示例:</p>
265
+ <pre class="prettyprint source lang-javascript"><code>// 创建几个具有不同级别的日志记录器
266
+ const logger1 = Logger.getLogger('Logger1', { level: 'TRACE' });
267
+ const logger2 = Logger.getLogger('Logger2', { level: 'INFO' });
268
+ const logger3 = Logger.getLogger('Logger3', { level: 'ERROR' });
269
+
270
+ // 一次将所有日志记录器更改为WARN级别
271
+ Logger.setAllLevels('WARN');
272
+
273
+ // 现在所有日志记录器将只显示WARN和ERROR消息
274
+ logger1.info('这不会显示');
275
+ logger2.warn('这会显示');
276
+ logger3.error('这会显示');
277
+
278
+ // 将所有日志记录器重置为使用默认级别
279
+ Logger.resetAllLevels();
280
+
281
+ // 将自定义输出器应用于所有现有的日志记录器
282
+ const fileAppender = { /* ... 记录到文件的实现 ... */ };
283
+ Logger.setAllAppenders(fileAppender);
284
+ </code></pre>
285
+ <h3>重置日志记录器</h3>
174
286
  <ul>
175
- <li><code>Logger.reset()</code>: Resets all loggers to the factory default settings. This
176
- includes clearing all existing loggers, and resetting the default logging
177
- level and the default logging appender.</li>
287
+ <li><code>Logger.reset()</code>:将日志记录器重置为出厂状态。这将清除所有已注册的日志记录器、重置默认日志级别和默认日志 appender。</li>
178
288
  </ul>
179
- <h2>The <code>@Log</code> Decorator</h2>
180
- <p>The <code>@Log</code> decorator automatically logs the method signature, including the
181
- class name, method name, and parameters.</p>
182
- <p>Example:</p>
289
+ <p>示例:</p>
290
+ <pre class="prettyprint source lang-javascript"><code>// 在对日志记录器和默认设置进行多次修改后
291
+ // 这一个调用将一切重置为工厂设置
292
+ Logger.reset();
293
+ </code></pre>
294
+ <h2><code>@Log</code> 装饰器</h2>
295
+ <p><code>@Log</code> 装饰器会自动记录方法签名,包括类名、方法名和参数。</p>
296
+ <p>示例:</p>
183
297
  <pre class="prettyprint source lang-javascript"><code>import { Log } from '@qubit-ltd/logging';
184
298
 
185
299
  class Person {
186
300
  @Log
187
301
  eat(meal) {
188
- // method implementation
302
+ // 方法实现
303
+ return `正在吃${meal.name}`;
304
+ }
305
+
306
+ // Log装饰器的自定义选项
307
+ @Log({ level: 'INFO', withResult: true })
308
+ calculateCalories(food, amount) {
309
+ const calories = food.caloriesPerUnit * amount;
310
+ return calories;
189
311
  }
190
312
  }
191
313
 
192
314
  const person = new Person();
193
- const meal = new Meal();
194
- person.eat(meal); // The log will print the method calling signature
315
+ const meal = { name: '早餐', type: '健康' };
316
+ person.eat(meal);
317
+ // 记录: &quot;Person.eat({&quot;name&quot;:&quot;早餐&quot;,&quot;type&quot;:&quot;健康&quot;})&quot;
318
+
319
+ const calories = person.calculateCalories({ caloriesPerUnit: 50 }, 4);
320
+ // 记录: &quot;Person.calculateCalories({&quot;caloriesPerUnit&quot;:50}, 4) => 200&quot;
195
321
  </code></pre>
196
- <h2>The <code>@HasLogger</code> Decorator</h2>
197
- <p>The <code>@HasLogger</code> decorator adds a named logger to a class, which is accessibl
198
- via the <code>logger</code> property.</p>
199
- <p>Example:</p>
322
+ <h2><code>@HasLogger</code> 装饰器</h2>
323
+ <p><code>@HasLogger</code> 装饰器会为类添加一个命名的日志记录器,可以通过 <code>logger</code> 属性访问。</p>
324
+ <p>示例:</p>
200
325
  <pre class="prettyprint source lang-javascript"><code>import { HasLogger } from '@qubit-ltd/logging';
201
326
 
202
327
  @HasLogger
203
328
  class MyClass {
204
329
  foo() {
205
- this.logger.debug('This is MyClass.foo()');
330
+ this.logger.debug('这是MyClass.foo()');
331
+ }
332
+
333
+ bar(param) {
334
+ this.logger.info('使用参数处理: %o', param);
335
+ // 使用param做一些事情
336
+ if (param.value &lt; 0) {
337
+ this.logger.warn('检测到负值: %d', param.value);
338
+ }
339
+ return param.value * 2;
206
340
  }
207
341
  }
342
+
343
+ const instance = new MyClass();
344
+ instance.foo();
345
+ instance.bar({ value: -5 });
208
346
  </code></pre>
209
- <h2>Using with Vue.js Class Components</h2>
210
- <p>You can use the <code>@Log</code> and <code>@HasLogger</code> decorators with <a href="https://github.com/Haixing-Hu/vue3-class-component/">Vue.js class components</a>:</p>
347
+ <h2>与 Vue.js 类组件一起使用</h2>
348
+ <p>你可以在<a href="https://github.com/Haixing-Hu/vue3-class-component/">Vue.js 类组件</a>中使用 <code>@Log</code> 和 <code>@HasLogger</code> 装饰器:</p>
211
349
  <pre class="prettyprint source lang-javascript"><code>import { HasLogger, Log } from '@qubit-ltd/logging';
212
350
  import { Component, toVue } from '@qubit-ltd/vue3-class-component';
213
351
 
@@ -221,19 +359,87 @@ class MyComponent {
221
359
 
222
360
  @Log
223
361
  foo() {
224
- this.logger.debug('This is MyComponent.foo()');
362
+ this.logger.debug('这是MyComponent.foo()');
363
+ this.message = '点击于 ' + new Date().toLocaleTimeString();
364
+ }
365
+
366
+ @Log({ level: 'INFO' })
367
+ async fetchData() {
368
+ try {
369
+ this.logger.info('从API获取数据...');
370
+ const response = await fetch('/api/data');
371
+ const data = await response.json();
372
+ this.logger.info('接收到数据: %o', data);
373
+ return data;
374
+ } catch (error) {
375
+ this.logger.error('获取数据失败: %o', error);
376
+ throw error;
377
+ }
225
378
  }
226
379
  }
227
380
 
228
381
  export default toVue(MyComponent);
229
382
  </code></pre>
230
- <p><strong>Note</strong>: The <code>@HasLogger</code> decorator must be placed <strong>after</strong> the <code>@Component</code> decorator.</p>
231
- <h2><span id="contributing">Contributing</span></h2>
232
- <p>If you find any issues or have suggestions for improvements, please feel free
233
- to open an issue or submit a pull request to the <a href="https://github.com/Haixing-Hu/js-logging">GitHub repository</a>.</p>
234
- <h2><span id="license">License</span></h2>
235
- <p><a href="https://npmjs.com/package/@qubit-ltd/logging">@qubit-ltd/logging</a> is distributed under the Apache 2.0 license.
236
- See the <a href="LICENSE">LICENSE</a> file for more details.</p></article>
383
+ <p><strong>注意</strong>:<code>@HasLogger</code> 装饰器必须放在 <code>@Component</code> 装饰器的<strong>后面</strong>。</p>
384
+ <h2>高级用法</h2>
385
+ <h3>创建自定义输出器</h3>
386
+ <p>你可以创建自定义输出器将日志定向到不同的目的地:</p>
387
+ <pre class="prettyprint source lang-javascript"><code>// 文件日志输出器(Node.js示例)
388
+ import fs from 'fs';
389
+
390
+ const fileAppender = {
391
+ _writeToFile(level, message, ...args) {
392
+ const formattedArgs = args.map(arg =>
393
+ typeof arg === 'object' ? JSON.stringify(arg) : String(arg)
394
+ );
395
+ const logEntry = `[${new Date().toISOString()}] [${level}] ${message} ${formattedArgs.join(' ')}\n`;
396
+ fs.appendFileSync('application.log', logEntry);
397
+ },
398
+ trace: function(message, ...args) { this._writeToFile('TRACE', message, ...args); },
399
+ debug: function(message, ...args) { this._writeToFile('DEBUG', message, ...args); },
400
+ info: function(message, ...args) { this._writeToFile('INFO', message, ...args); },
401
+ warn: function(message, ...args) { this._writeToFile('WARN', message, ...args); },
402
+ error: function(message, ...args) { this._writeToFile('ERROR', message, ...args); }
403
+ };
404
+
405
+ // 使用自定义输出器
406
+ const logger = Logger.getLogger('AppLogger', { appender: fileAppender });
407
+ </code></pre>
408
+ <h3>条件日志记录</h3>
409
+ <pre class="prettyprint source lang-javascript"><code>import Logger from '@qubit-ltd/logging';
410
+
411
+ function processData(data, options = {}) {
412
+ const logger = Logger.getLogger('DataProcessor');
413
+
414
+ // 仅在明确请求时启用调试日志
415
+ if (options.debug) {
416
+ logger.setLevel('DEBUG');
417
+ } else {
418
+ logger.setLevel('INFO');
419
+ }
420
+
421
+ logger.debug('使用选项处理数据: %o', options);
422
+ // 函数的其余部分
423
+ }
424
+ </code></pre>
425
+ <h2><span id="contributing">贡献</span></h2>
426
+ <p>如果您发现任何问题或有改进建议,请随时在<a href="https://github.com/Haixing-Hu/js-logging">GitHub 仓库</a>上提交 issue 或 pull request。</p>
427
+ <h3>开发设置</h3>
428
+ <pre class="prettyprint source lang-bash"><code># 克隆仓库
429
+ git clone https://github.com/Haixing-Hu/js-logging.git
430
+ cd js-logging
431
+
432
+ # 安装依赖
433
+ yarn install
434
+
435
+ # 运行测试
436
+ yarn test
437
+
438
+ # 构建库
439
+ yarn build
440
+ </code></pre>
441
+ <h2><span id="license">许可证</span></h2>
442
+ <p><a href="https://npmjs.com/package/@qubit-ltd/logging">@qubit-ltd/logging</a> 根据 Apache 2.0 许可证分发。详情请参阅 <a href="LICENSE">LICENSE</a> 文件。</p></article>
237
443
  </section>
238
444
 
239
445
 
@@ -247,7 +453,7 @@ See the <a href="LICENSE">LICENSE</a> file for more details.</p></article>
247
453
 
248
454
  <footer>
249
455
  Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
250
- on Sun Jan 05 2025 14:31:57 GMT+0800 (China Standard Time)
456
+ on Wed Apr 16 2025 13:49:41 GMT+0800 (China Standard Time)
251
457
  using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
252
458
  </footer>
253
459
 
@@ -4929,7 +4929,7 @@ var drawChart = (function (exports) {
4929
4929
  </script>
4930
4930
  <script>
4931
4931
  /*<!--*/
4932
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"logging.min.iife.js","children":[{"name":"node_modules/@babel/runtime/helpers/esm","children":[{"uid":"389cf136-1","name":"classCallCheck.js"},{"uid":"389cf136-3","name":"typeof.js"},{"uid":"389cf136-5","name":"toPrimitive.js"},{"uid":"389cf136-7","name":"toPropertyKey.js"},{"uid":"389cf136-9","name":"createClass.js"},{"uid":"389cf136-23","name":"arrayLikeToArray.js"},{"uid":"389cf136-25","name":"arrayWithoutHoles.js"},{"uid":"389cf136-27","name":"iterableToArray.js"},{"uid":"389cf136-29","name":"unsupportedIterableToArray.js"},{"uid":"389cf136-31","name":"nonIterableSpread.js"},{"uid":"389cf136-33","name":"toConsumableArray.js"}]},{"name":"src","children":[{"name":"impl","children":[{"uid":"389cf136-11","name":"logging-levels.js"},{"uid":"389cf136-13","name":"check-appender.js"},{"uid":"389cf136-15","name":"check-logging-level.js"},{"uid":"389cf136-17","name":"upper-case-string.js"},{"uid":"389cf136-19","name":"is-string.js"},{"uid":"389cf136-21","name":"get-browser-engine.js"},{"uid":"389cf136-35","name":"get-logging-prefix.js"},{"uid":"389cf136-37","name":"fix-first-argument.js"},{"uid":"389cf136-39","name":"bind-with-arrow-function.js"},{"uid":"389cf136-41","name":"bind-without-prefix.js"},{"uid":"389cf136-43","name":"bind-with-function-bind.js"},{"uid":"389cf136-45","name":"bind-logging-methods.js"},{"uid":"389cf136-49","name":"metadata-keys.js"}]},{"uid":"389cf136-47","name":"logger.js"},{"uid":"389cf136-51","name":"log.js"},{"uid":"389cf136-53","name":"has-logger.js"},{"uid":"389cf136-55","name":"index.js"}]}]}],"isRoot":true},"nodeParts":{"389cf136-1":{"renderedLength":117,"gzipLength":119,"brotliLength":101,"metaUid":"389cf136-0"},"389cf136-3":{"renderedLength":335,"gzipLength":176,"brotliLength":142,"metaUid":"389cf136-2"},"389cf136-5":{"renderedLength":299,"gzipLength":201,"brotliLength":162,"metaUid":"389cf136-4"},"389cf136-7":{"renderedLength":111,"gzipLength":121,"brotliLength":93,"metaUid":"389cf136-6"},"389cf136-9":{"renderedLength":413,"gzipLength":244,"brotliLength":202,"metaUid":"389cf136-8"},"389cf136-11":{"renderedLength":421,"gzipLength":226,"brotliLength":187,"metaUid":"389cf136-10"},"389cf136-13":{"renderedLength":832,"gzipLength":465,"brotliLength":375,"metaUid":"389cf136-12"},"389cf136-15":{"renderedLength":800,"gzipLength":404,"brotliLength":323,"metaUid":"389cf136-14"},"389cf136-17":{"renderedLength":703,"gzipLength":323,"brotliLength":260,"metaUid":"389cf136-16"},"389cf136-19":{"renderedLength":644,"gzipLength":304,"brotliLength":235,"metaUid":"389cf136-18"},"389cf136-21":{"renderedLength":1161,"gzipLength":440,"brotliLength":336,"metaUid":"389cf136-20"},"389cf136-23":{"renderedLength":156,"gzipLength":143,"brotliLength":115,"metaUid":"389cf136-22"},"389cf136-25":{"renderedLength":89,"gzipLength":92,"brotliLength":86,"metaUid":"389cf136-24"},"389cf136-27":{"renderedLength":147,"gzipLength":136,"brotliLength":102,"metaUid":"389cf136-26"},"389cf136-29":{"renderedLength":400,"gzipLength":272,"brotliLength":217,"metaUid":"389cf136-28"},"389cf136-31":{"renderedLength":192,"gzipLength":164,"brotliLength":120,"metaUid":"389cf136-30"},"389cf136-33":{"renderedLength":149,"gzipLength":128,"brotliLength":103,"metaUid":"389cf136-32"},"389cf136-35":{"renderedLength":674,"gzipLength":301,"brotliLength":259,"metaUid":"389cf136-34"},"389cf136-37":{"renderedLength":243,"gzipLength":167,"brotliLength":147,"metaUid":"389cf136-36"},"389cf136-39":{"renderedLength":1452,"gzipLength":645,"brotliLength":521,"metaUid":"389cf136-38"},"389cf136-41":{"renderedLength":1295,"gzipLength":588,"brotliLength":469,"metaUid":"389cf136-40"},"389cf136-43":{"renderedLength":2083,"gzipLength":864,"brotliLength":695,"metaUid":"389cf136-42"},"389cf136-45":{"renderedLength":2804,"gzipLength":923,"brotliLength":761,"metaUid":"389cf136-44"},"389cf136-47":{"renderedLength":21844,"gzipLength":4527,"brotliLength":3871,"metaUid":"389cf136-46"},"389cf136-49":{"renderedLength":344,"gzipLength":178,"brotliLength":145,"metaUid":"389cf136-48"},"389cf136-51":{"renderedLength":4307,"gzipLength":1653,"brotliLength":1372,"metaUid":"389cf136-50"},"389cf136-53":{"renderedLength":2007,"gzipLength":808,"brotliLength":653,"metaUid":"389cf136-52"},"389cf136-55":{"renderedLength":264,"gzipLength":101,"brotliLength":98,"metaUid":"389cf136-54"}},"nodeMetas":{"389cf136-0":{"id":"/node_modules/@babel/runtime/helpers/esm/classCallCheck.js","moduleParts":{"logging.min.iife.js":"389cf136-1"},"imported":[],"importedBy":[{"uid":"389cf136-46"}]},"389cf136-2":{"id":"/node_modules/@babel/runtime/helpers/esm/typeof.js","moduleParts":{"logging.min.iife.js":"389cf136-3"},"imported":[],"importedBy":[{"uid":"389cf136-50"},{"uid":"389cf136-52"},{"uid":"389cf136-12"},{"uid":"389cf136-6"},{"uid":"389cf136-4"}]},"389cf136-4":{"id":"/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","moduleParts":{"logging.min.iife.js":"389cf136-5"},"imported":[{"uid":"389cf136-2"}],"importedBy":[{"uid":"389cf136-6"}]},"389cf136-6":{"id":"/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","moduleParts":{"logging.min.iife.js":"389cf136-7"},"imported":[{"uid":"389cf136-2"},{"uid":"389cf136-4"}],"importedBy":[{"uid":"389cf136-8"}]},"389cf136-8":{"id":"/node_modules/@babel/runtime/helpers/esm/createClass.js","moduleParts":{"logging.min.iife.js":"389cf136-9"},"imported":[{"uid":"389cf136-6"}],"importedBy":[{"uid":"389cf136-46"}]},"389cf136-10":{"id":"/src/impl/logging-levels.js","moduleParts":{"logging.min.iife.js":"389cf136-11"},"imported":[],"importedBy":[{"uid":"389cf136-46"},{"uid":"389cf136-12"},{"uid":"389cf136-14"},{"uid":"389cf136-44"}]},"389cf136-12":{"id":"/src/impl/check-appender.js","moduleParts":{"logging.min.iife.js":"389cf136-13"},"imported":[{"uid":"389cf136-2"},{"uid":"389cf136-10"}],"importedBy":[{"uid":"389cf136-46"}]},"389cf136-14":{"id":"/src/impl/check-logging-level.js","moduleParts":{"logging.min.iife.js":"389cf136-15"},"imported":[{"uid":"389cf136-10"}],"importedBy":[{"uid":"389cf136-46"}]},"389cf136-16":{"id":"/src/impl/upper-case-string.js","moduleParts":{"logging.min.iife.js":"389cf136-17"},"imported":[],"importedBy":[{"uid":"389cf136-46"}]},"389cf136-18":{"id":"/src/impl/is-string.js","moduleParts":{"logging.min.iife.js":"389cf136-19"},"imported":[],"importedBy":[{"uid":"389cf136-46"},{"uid":"389cf136-36"}]},"389cf136-20":{"id":"/src/impl/get-browser-engine.js","moduleParts":{"logging.min.iife.js":"389cf136-21"},"imported":[],"importedBy":[{"uid":"389cf136-44"}]},"389cf136-22":{"id":"/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","moduleParts":{"logging.min.iife.js":"389cf136-23"},"imported":[],"importedBy":[{"uid":"389cf136-24"},{"uid":"389cf136-28"}]},"389cf136-24":{"id":"/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","moduleParts":{"logging.min.iife.js":"389cf136-25"},"imported":[{"uid":"389cf136-22"}],"importedBy":[{"uid":"389cf136-32"}]},"389cf136-26":{"id":"/node_modules/@babel/runtime/helpers/esm/iterableToArray.js","moduleParts":{"logging.min.iife.js":"389cf136-27"},"imported":[],"importedBy":[{"uid":"389cf136-32"}]},"389cf136-28":{"id":"/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","moduleParts":{"logging.min.iife.js":"389cf136-29"},"imported":[{"uid":"389cf136-22"}],"importedBy":[{"uid":"389cf136-32"}]},"389cf136-30":{"id":"/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","moduleParts":{"logging.min.iife.js":"389cf136-31"},"imported":[],"importedBy":[{"uid":"389cf136-32"}]},"389cf136-32":{"id":"/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","moduleParts":{"logging.min.iife.js":"389cf136-33"},"imported":[{"uid":"389cf136-24"},{"uid":"389cf136-26"},{"uid":"389cf136-28"},{"uid":"389cf136-30"}],"importedBy":[{"uid":"389cf136-50"},{"uid":"389cf136-38"},{"uid":"389cf136-36"}]},"389cf136-34":{"id":"/src/impl/get-logging-prefix.js","moduleParts":{"logging.min.iife.js":"389cf136-35"},"imported":[],"importedBy":[{"uid":"389cf136-38"},{"uid":"389cf136-42"}]},"389cf136-36":{"id":"/src/impl/fix-first-argument.js","moduleParts":{"logging.min.iife.js":"389cf136-37"},"imported":[{"uid":"389cf136-32"},{"uid":"389cf136-18"}],"importedBy":[{"uid":"389cf136-38"}]},"389cf136-38":{"id":"/src/impl/bind-with-arrow-function.js","moduleParts":{"logging.min.iife.js":"389cf136-39"},"imported":[{"uid":"389cf136-32"},{"uid":"389cf136-34"},{"uid":"389cf136-36"}],"importedBy":[{"uid":"389cf136-44"}]},"389cf136-40":{"id":"/src/impl/bind-without-prefix.js","moduleParts":{"logging.min.iife.js":"389cf136-41"},"imported":[],"importedBy":[{"uid":"389cf136-44"}]},"389cf136-42":{"id":"/src/impl/bind-with-function-bind.js","moduleParts":{"logging.min.iife.js":"389cf136-43"},"imported":[{"uid":"389cf136-34"}],"importedBy":[{"uid":"389cf136-44"}]},"389cf136-44":{"id":"/src/impl/bind-logging-methods.js","moduleParts":{"logging.min.iife.js":"389cf136-45"},"imported":[{"uid":"389cf136-10"},{"uid":"389cf136-20"},{"uid":"389cf136-38"},{"uid":"389cf136-40"},{"uid":"389cf136-42"}],"importedBy":[{"uid":"389cf136-46"}]},"389cf136-46":{"id":"/src/logger.js","moduleParts":{"logging.min.iife.js":"389cf136-47"},"imported":[{"uid":"389cf136-0"},{"uid":"389cf136-8"},{"uid":"389cf136-10"},{"uid":"389cf136-12"},{"uid":"389cf136-14"},{"uid":"389cf136-16"},{"uid":"389cf136-18"},{"uid":"389cf136-44"}],"importedBy":[{"uid":"389cf136-54"},{"uid":"389cf136-50"},{"uid":"389cf136-52"}]},"389cf136-48":{"id":"/src/impl/metadata-keys.js","moduleParts":{"logging.min.iife.js":"389cf136-49"},"imported":[],"importedBy":[{"uid":"389cf136-50"}]},"389cf136-50":{"id":"/src/log.js","moduleParts":{"logging.min.iife.js":"389cf136-51"},"imported":[{"uid":"389cf136-2"},{"uid":"389cf136-32"},{"uid":"389cf136-46"},{"uid":"389cf136-48"}],"importedBy":[{"uid":"389cf136-54"}]},"389cf136-52":{"id":"/src/has-logger.js","moduleParts":{"logging.min.iife.js":"389cf136-53"},"imported":[{"uid":"389cf136-2"},{"uid":"389cf136-46"}],"importedBy":[{"uid":"389cf136-54"}]},"389cf136-54":{"id":"/src/index.js","moduleParts":{"logging.min.iife.js":"389cf136-55"},"imported":[{"uid":"389cf136-46"},{"uid":"389cf136-50"},{"uid":"389cf136-52"}],"importedBy":[],"isEntry":true}},"env":{"rollup":"4.29.1"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
4932
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"logging.min.iife.js","children":[{"name":"node_modules/@babel/runtime/helpers/esm","children":[{"uid":"c17c6645-1","name":"classCallCheck.js"},{"uid":"c17c6645-3","name":"typeof.js"},{"uid":"c17c6645-5","name":"toPrimitive.js"},{"uid":"c17c6645-7","name":"toPropertyKey.js"},{"uid":"c17c6645-9","name":"createClass.js"},{"uid":"c17c6645-23","name":"arrayLikeToArray.js"},{"uid":"c17c6645-25","name":"arrayWithoutHoles.js"},{"uid":"c17c6645-27","name":"iterableToArray.js"},{"uid":"c17c6645-29","name":"unsupportedIterableToArray.js"},{"uid":"c17c6645-31","name":"nonIterableSpread.js"},{"uid":"c17c6645-33","name":"toConsumableArray.js"}]},{"name":"src","children":[{"name":"impl","children":[{"uid":"c17c6645-11","name":"logging-levels.js"},{"uid":"c17c6645-13","name":"check-appender.js"},{"uid":"c17c6645-15","name":"check-logging-level.js"},{"uid":"c17c6645-17","name":"upper-case-string.js"},{"uid":"c17c6645-19","name":"is-string.js"},{"uid":"c17c6645-21","name":"get-browser-engine.js"},{"uid":"c17c6645-35","name":"get-logging-prefix.js"},{"uid":"c17c6645-37","name":"fix-first-argument.js"},{"uid":"c17c6645-39","name":"bind-with-arrow-function.js"},{"uid":"c17c6645-41","name":"bind-without-prefix.js"},{"uid":"c17c6645-43","name":"bind-with-function-bind.js"},{"uid":"c17c6645-45","name":"bind-logging-methods.js"},{"uid":"c17c6645-49","name":"metadata-keys.js"}]},{"uid":"c17c6645-47","name":"logger.js"},{"uid":"c17c6645-51","name":"log.js"},{"uid":"c17c6645-53","name":"has-logger.js"},{"uid":"c17c6645-55","name":"index.js"}]}]}],"isRoot":true},"nodeParts":{"c17c6645-1":{"renderedLength":117,"gzipLength":119,"brotliLength":101,"metaUid":"c17c6645-0"},"c17c6645-3":{"renderedLength":335,"gzipLength":176,"brotliLength":142,"metaUid":"c17c6645-2"},"c17c6645-5":{"renderedLength":299,"gzipLength":201,"brotliLength":162,"metaUid":"c17c6645-4"},"c17c6645-7":{"renderedLength":111,"gzipLength":121,"brotliLength":93,"metaUid":"c17c6645-6"},"c17c6645-9":{"renderedLength":433,"gzipLength":250,"brotliLength":209,"metaUid":"c17c6645-8"},"c17c6645-11":{"renderedLength":421,"gzipLength":226,"brotliLength":187,"metaUid":"c17c6645-10"},"c17c6645-13":{"renderedLength":832,"gzipLength":465,"brotliLength":375,"metaUid":"c17c6645-12"},"c17c6645-15":{"renderedLength":800,"gzipLength":404,"brotliLength":323,"metaUid":"c17c6645-14"},"c17c6645-17":{"renderedLength":703,"gzipLength":323,"brotliLength":260,"metaUid":"c17c6645-16"},"c17c6645-19":{"renderedLength":644,"gzipLength":304,"brotliLength":235,"metaUid":"c17c6645-18"},"c17c6645-21":{"renderedLength":1161,"gzipLength":440,"brotliLength":336,"metaUid":"c17c6645-20"},"c17c6645-23":{"renderedLength":156,"gzipLength":143,"brotliLength":115,"metaUid":"c17c6645-22"},"c17c6645-25":{"renderedLength":89,"gzipLength":92,"brotliLength":86,"metaUid":"c17c6645-24"},"c17c6645-27":{"renderedLength":147,"gzipLength":136,"brotliLength":102,"metaUid":"c17c6645-26"},"c17c6645-29":{"renderedLength":400,"gzipLength":272,"brotliLength":217,"metaUid":"c17c6645-28"},"c17c6645-31":{"renderedLength":192,"gzipLength":164,"brotliLength":120,"metaUid":"c17c6645-30"},"c17c6645-33":{"renderedLength":149,"gzipLength":128,"brotliLength":103,"metaUid":"c17c6645-32"},"c17c6645-35":{"renderedLength":674,"gzipLength":301,"brotliLength":259,"metaUid":"c17c6645-34"},"c17c6645-37":{"renderedLength":243,"gzipLength":167,"brotliLength":147,"metaUid":"c17c6645-36"},"c17c6645-39":{"renderedLength":1452,"gzipLength":645,"brotliLength":521,"metaUid":"c17c6645-38"},"c17c6645-41":{"renderedLength":1295,"gzipLength":588,"brotliLength":469,"metaUid":"c17c6645-40"},"c17c6645-43":{"renderedLength":2083,"gzipLength":864,"brotliLength":695,"metaUid":"c17c6645-42"},"c17c6645-45":{"renderedLength":2804,"gzipLength":923,"brotliLength":761,"metaUid":"c17c6645-44"},"c17c6645-47":{"renderedLength":21856,"gzipLength":4529,"brotliLength":3864,"metaUid":"c17c6645-46"},"c17c6645-49":{"renderedLength":344,"gzipLength":178,"brotliLength":145,"metaUid":"c17c6645-48"},"c17c6645-51":{"renderedLength":4307,"gzipLength":1653,"brotliLength":1372,"metaUid":"c17c6645-50"},"c17c6645-53":{"renderedLength":2007,"gzipLength":808,"brotliLength":653,"metaUid":"c17c6645-52"},"c17c6645-55":{"renderedLength":264,"gzipLength":101,"brotliLength":98,"metaUid":"c17c6645-54"}},"nodeMetas":{"c17c6645-0":{"id":"/node_modules/@babel/runtime/helpers/esm/classCallCheck.js","moduleParts":{"logging.min.iife.js":"c17c6645-1"},"imported":[],"importedBy":[{"uid":"c17c6645-46"}]},"c17c6645-2":{"id":"/node_modules/@babel/runtime/helpers/esm/typeof.js","moduleParts":{"logging.min.iife.js":"c17c6645-3"},"imported":[],"importedBy":[{"uid":"c17c6645-50"},{"uid":"c17c6645-52"},{"uid":"c17c6645-12"},{"uid":"c17c6645-6"},{"uid":"c17c6645-4"}]},"c17c6645-4":{"id":"/node_modules/@babel/runtime/helpers/esm/toPrimitive.js","moduleParts":{"logging.min.iife.js":"c17c6645-5"},"imported":[{"uid":"c17c6645-2"}],"importedBy":[{"uid":"c17c6645-6"}]},"c17c6645-6":{"id":"/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","moduleParts":{"logging.min.iife.js":"c17c6645-7"},"imported":[{"uid":"c17c6645-2"},{"uid":"c17c6645-4"}],"importedBy":[{"uid":"c17c6645-8"}]},"c17c6645-8":{"id":"/node_modules/@babel/runtime/helpers/esm/createClass.js","moduleParts":{"logging.min.iife.js":"c17c6645-9"},"imported":[{"uid":"c17c6645-6"}],"importedBy":[{"uid":"c17c6645-46"}]},"c17c6645-10":{"id":"/src/impl/logging-levels.js","moduleParts":{"logging.min.iife.js":"c17c6645-11"},"imported":[],"importedBy":[{"uid":"c17c6645-46"},{"uid":"c17c6645-12"},{"uid":"c17c6645-14"},{"uid":"c17c6645-44"}]},"c17c6645-12":{"id":"/src/impl/check-appender.js","moduleParts":{"logging.min.iife.js":"c17c6645-13"},"imported":[{"uid":"c17c6645-2"},{"uid":"c17c6645-10"}],"importedBy":[{"uid":"c17c6645-46"}]},"c17c6645-14":{"id":"/src/impl/check-logging-level.js","moduleParts":{"logging.min.iife.js":"c17c6645-15"},"imported":[{"uid":"c17c6645-10"}],"importedBy":[{"uid":"c17c6645-46"}]},"c17c6645-16":{"id":"/src/impl/upper-case-string.js","moduleParts":{"logging.min.iife.js":"c17c6645-17"},"imported":[],"importedBy":[{"uid":"c17c6645-46"}]},"c17c6645-18":{"id":"/src/impl/is-string.js","moduleParts":{"logging.min.iife.js":"c17c6645-19"},"imported":[],"importedBy":[{"uid":"c17c6645-46"},{"uid":"c17c6645-36"}]},"c17c6645-20":{"id":"/src/impl/get-browser-engine.js","moduleParts":{"logging.min.iife.js":"c17c6645-21"},"imported":[],"importedBy":[{"uid":"c17c6645-44"}]},"c17c6645-22":{"id":"/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js","moduleParts":{"logging.min.iife.js":"c17c6645-23"},"imported":[],"importedBy":[{"uid":"c17c6645-24"},{"uid":"c17c6645-28"}]},"c17c6645-24":{"id":"/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js","moduleParts":{"logging.min.iife.js":"c17c6645-25"},"imported":[{"uid":"c17c6645-22"}],"importedBy":[{"uid":"c17c6645-32"}]},"c17c6645-26":{"id":"/node_modules/@babel/runtime/helpers/esm/iterableToArray.js","moduleParts":{"logging.min.iife.js":"c17c6645-27"},"imported":[],"importedBy":[{"uid":"c17c6645-32"}]},"c17c6645-28":{"id":"/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js","moduleParts":{"logging.min.iife.js":"c17c6645-29"},"imported":[{"uid":"c17c6645-22"}],"importedBy":[{"uid":"c17c6645-32"}]},"c17c6645-30":{"id":"/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js","moduleParts":{"logging.min.iife.js":"c17c6645-31"},"imported":[],"importedBy":[{"uid":"c17c6645-32"}]},"c17c6645-32":{"id":"/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js","moduleParts":{"logging.min.iife.js":"c17c6645-33"},"imported":[{"uid":"c17c6645-24"},{"uid":"c17c6645-26"},{"uid":"c17c6645-28"},{"uid":"c17c6645-30"}],"importedBy":[{"uid":"c17c6645-50"},{"uid":"c17c6645-38"},{"uid":"c17c6645-36"}]},"c17c6645-34":{"id":"/src/impl/get-logging-prefix.js","moduleParts":{"logging.min.iife.js":"c17c6645-35"},"imported":[],"importedBy":[{"uid":"c17c6645-38"},{"uid":"c17c6645-42"}]},"c17c6645-36":{"id":"/src/impl/fix-first-argument.js","moduleParts":{"logging.min.iife.js":"c17c6645-37"},"imported":[{"uid":"c17c6645-32"},{"uid":"c17c6645-18"}],"importedBy":[{"uid":"c17c6645-38"}]},"c17c6645-38":{"id":"/src/impl/bind-with-arrow-function.js","moduleParts":{"logging.min.iife.js":"c17c6645-39"},"imported":[{"uid":"c17c6645-32"},{"uid":"c17c6645-34"},{"uid":"c17c6645-36"}],"importedBy":[{"uid":"c17c6645-44"}]},"c17c6645-40":{"id":"/src/impl/bind-without-prefix.js","moduleParts":{"logging.min.iife.js":"c17c6645-41"},"imported":[],"importedBy":[{"uid":"c17c6645-44"}]},"c17c6645-42":{"id":"/src/impl/bind-with-function-bind.js","moduleParts":{"logging.min.iife.js":"c17c6645-43"},"imported":[{"uid":"c17c6645-34"}],"importedBy":[{"uid":"c17c6645-44"}]},"c17c6645-44":{"id":"/src/impl/bind-logging-methods.js","moduleParts":{"logging.min.iife.js":"c17c6645-45"},"imported":[{"uid":"c17c6645-10"},{"uid":"c17c6645-20"},{"uid":"c17c6645-38"},{"uid":"c17c6645-40"},{"uid":"c17c6645-42"}],"importedBy":[{"uid":"c17c6645-46"}]},"c17c6645-46":{"id":"/src/logger.js","moduleParts":{"logging.min.iife.js":"c17c6645-47"},"imported":[{"uid":"c17c6645-0"},{"uid":"c17c6645-8"},{"uid":"c17c6645-10"},{"uid":"c17c6645-12"},{"uid":"c17c6645-14"},{"uid":"c17c6645-16"},{"uid":"c17c6645-18"},{"uid":"c17c6645-44"}],"importedBy":[{"uid":"c17c6645-54"},{"uid":"c17c6645-50"},{"uid":"c17c6645-52"}]},"c17c6645-48":{"id":"/src/impl/metadata-keys.js","moduleParts":{"logging.min.iife.js":"c17c6645-49"},"imported":[],"importedBy":[{"uid":"c17c6645-50"}]},"c17c6645-50":{"id":"/src/log.js","moduleParts":{"logging.min.iife.js":"c17c6645-51"},"imported":[{"uid":"c17c6645-2"},{"uid":"c17c6645-32"},{"uid":"c17c6645-46"},{"uid":"c17c6645-48"}],"importedBy":[{"uid":"c17c6645-54"}]},"c17c6645-52":{"id":"/src/has-logger.js","moduleParts":{"logging.min.iife.js":"c17c6645-53"},"imported":[{"uid":"c17c6645-2"},{"uid":"c17c6645-46"}],"importedBy":[{"uid":"c17c6645-54"}]},"c17c6645-54":{"id":"/src/index.js","moduleParts":{"logging.min.iife.js":"c17c6645-55"},"imported":[{"uid":"c17c6645-46"},{"uid":"c17c6645-50"},{"uid":"c17c6645-52"}],"importedBy":[],"isEntry":true}},"env":{"rollup":"4.40.0"},"options":{"gzip":true,"brotli":true,"sourcemap":false}};
4933
4933
 
4934
4934
  const run = () => {
4935
4935
  const width = window.innerWidth;