@qubit-ltd/logging 1.4.4
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/LICENSE +201 -0
- package/README.md +224 -0
- package/README.zh_CN.md +200 -0
- package/dist/logging.cjs +1338 -0
- package/dist/logging.cjs.map +1 -0
- package/dist/logging.iife.js +1342 -0
- package/dist/logging.iife.js.map +1 -0
- package/dist/logging.min.cjs +1 -0
- package/dist/logging.min.cjs.map +1 -0
- package/dist/logging.min.iife.js +1 -0
- package/dist/logging.min.iife.js.map +1 -0
- package/dist/logging.min.mjs +1 -0
- package/dist/logging.min.mjs.map +1 -0
- package/dist/logging.mjs +1330 -0
- package/dist/logging.mjs.map +1 -0
- package/doc/api/Logger.html +3352 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Light-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Light-webfont.svg +1839 -0
- package/doc/api/fonts/OpenSans-Light-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.svg +1843 -0
- package/doc/api/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.svg +1839 -0
- package/doc/api/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.ttf +0 -0
- package/doc/api/fonts/OpenSans-Semibold-webfont.woff +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.eot +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.svg +1838 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.ttf +0 -0
- package/doc/api/fonts/OpenSans-SemiboldItalic-webfont.woff +0 -0
- package/doc/api/global.html +787 -0
- package/doc/api/index.html +257 -0
- package/doc/api/scripts/linenumber.js +34 -0
- package/doc/api/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/doc/api/scripts/prettify/lang-css.js +2 -0
- package/doc/api/scripts/prettify/prettify.js +28 -0
- package/doc/api/styles/jsdoc-default.css +699 -0
- package/doc/api/styles/prettify-jsdoc.css +120 -0
- package/doc/api/styles/prettify-tomorrow.css +141 -0
- package/doc/logging.min.visualization.html +4949 -0
- package/doc/logging.visualization.html +4949 -0
- package/package.json +103 -0
|
@@ -0,0 +1,787 @@
|
|
|
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">
|
|
6
|
+
<title>Global - Documentation</title>
|
|
7
|
+
|
|
8
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
9
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
10
|
+
<!--[if lt IE 9]>
|
|
11
|
+
<script src="https://cdn.bootcdn.net/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
|
|
12
|
+
<![endif]-->
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/ionicons/2.0.1/css/ionicons.min.css">
|
|
14
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
15
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
|
|
19
|
+
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
|
20
|
+
<label for="nav-trigger" class="navicon-button x">
|
|
21
|
+
<div class="navicon"></div>
|
|
22
|
+
</label>
|
|
23
|
+
|
|
24
|
+
<label for="nav-trigger" class="overlay"></label>
|
|
25
|
+
|
|
26
|
+
<nav>
|
|
27
|
+
<li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="Logger.html">Logger</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#disable">disable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#enable">enable</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#getAppender">getAppender</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#getLevel">getLevel</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#getName">getName</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#log">log</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#setAppender">setAppender</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#setEnabled">setEnabled</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#setLevel">setLevel</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.clearAllLoggers">clearAllLoggers</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.getDefaultAppender">getDefaultAppender</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.getDefaultLevel">getDefaultLevel</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.getLogger">getLogger</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.getLoggerLevel">getLoggerLevel</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.reset">reset</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.resetAllAppenders">resetAllAppenders</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.resetAllLevels">resetAllLevels</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.resetDefaultAppender">resetDefaultAppender</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.resetDefaultLevel">resetDefaultLevel</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.setAllAppenders">setAllAppenders</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.setAllLevels">setAllLevels</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.setDefaultAppender">setDefaultAppender</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.setDefaultLevel">setDefaultLevel</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="Logger.html#.setLoggerLevel">setLoggerLevel</a></span></li><li class="nav-heading"><a href="global.html">Globals</a></li><li class="nav-item"><span class="nav-item-type type-member">M</span><span class="nav-item-name"><a href="global.html#FACTORY_DEFAULT_APPENDER">FACTORY_DEFAULT_APPENDER</a></span></li><li class="nav-item"><span class="nav-item-type type-member">M</span><span class="nav-item-name"><a href="global.html#FACTORY_DEFAULT_LEVEL">FACTORY_DEFAULT_LEVEL</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#HasLogger">HasLogger</a></span></li><li class="nav-item"><span class="nav-item-type type-member">M</span><span class="nav-item-name"><a href="global.html#LOGGING_LEVELS">LOGGING_LEVELS</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="global.html#Log">Log</a></span></li>
|
|
28
|
+
</nav>
|
|
29
|
+
|
|
30
|
+
<div id="main">
|
|
31
|
+
|
|
32
|
+
<h1 class="page-title">Global</h1>
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<section>
|
|
41
|
+
|
|
42
|
+
<header>
|
|
43
|
+
|
|
44
|
+
<h2>
|
|
45
|
+
|
|
46
|
+
</h2>
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
</header>
|
|
50
|
+
|
|
51
|
+
<article>
|
|
52
|
+
<div class="container-overview">
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
<dl class="details">
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
</dl>
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<h3 class="subsection-title">Members</h3>
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
<div class="section-members">
|
|
115
|
+
<h4 class="name" id="FACTORY_DEFAULT_APPENDER"><span class="type-signature">(constant) </span>FACTORY_DEFAULT_APPENDER<span class="type-signature"> :Console</span></h4>
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
<div class="description">
|
|
121
|
+
<p>The factory value of the Logger class's default log appender, which is
|
|
122
|
+
the standard output pipe of the console.</p>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
<dl class="details">
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
</dl>
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
<h5>Type:</h5>
|
|
167
|
+
<ul>
|
|
168
|
+
<li>
|
|
169
|
+
|
|
170
|
+
<span class="param-type"><code>Console</code></span>
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
</li>
|
|
174
|
+
</ul>
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
</div>
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
<div class="section-members">
|
|
185
|
+
<h4 class="name" id="FACTORY_DEFAULT_LEVEL"><span class="type-signature">(constant) </span>FACTORY_DEFAULT_LEVEL<span class="type-signature"> :string</span></h4>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
<div class="description">
|
|
191
|
+
<p>The factory value of the Logger class's default logging level,
|
|
192
|
+
which is <code>DEBUG</code>.</p>
|
|
193
|
+
</div>
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
<dl class="details">
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
</dl>
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
<h5>Type:</h5>
|
|
237
|
+
<ul>
|
|
238
|
+
<li>
|
|
239
|
+
|
|
240
|
+
<span class="param-type"><code>string</code></span>
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
</li>
|
|
244
|
+
</ul>
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
</div>
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
<div class="section-members">
|
|
255
|
+
<h4 class="name" id="LOGGING_LEVELS"><span class="type-signature">(constant) </span>LOGGING_LEVELS<span class="type-signature"></span></h4>
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
<div class="description">
|
|
261
|
+
<p>Predefined logging levels.</p>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
<dl class="details">
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
<dt class="tag-author">Author:</dt>
|
|
288
|
+
<dd class="tag-author">
|
|
289
|
+
<ul>
|
|
290
|
+
<li>Haixing Hu</li>
|
|
291
|
+
</ul>
|
|
292
|
+
</dd>
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
</dl>
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
</div>
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
<h3 class="subsection-title">Methods</h3>
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
<div class="section-method">
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
<h4 class="name" id="HasLogger"><span class="type-signature"></span>HasLogger<span class="signature">(Class, context)</span><span class="type-signature"> → {function}</span></h4>
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
<div class="description">
|
|
339
|
+
<p>A decorator to add a named logger to a class.</p>
|
|
340
|
+
<p>This decorator will add a named logger to the class, which can be accessed
|
|
341
|
+
via the <code>logger</code> property of the class.</p>
|
|
342
|
+
<p>Example usage:</p>
|
|
343
|
+
<pre class="prettyprint source lang-js"><code>import { HasLogger } from '@haixing_hu/logging';
|
|
344
|
+
|
|
345
|
+
@HasLogger
|
|
346
|
+
class MyClass {
|
|
347
|
+
foo() {
|
|
348
|
+
this.logger.debug('This is MyClass.foo()');
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
</code></pre>
|
|
352
|
+
<p>The following is another example usage with the class component of Vue.js:</p>
|
|
353
|
+
<pre class="prettyprint source lang-js"><code>import { Component, toVue } from '@haixing_hu/vue3-class-component';
|
|
354
|
+
import { HasLogger, Log } from '@haixing_hu/logging';
|
|
355
|
+
|
|
356
|
+
@Component({
|
|
357
|
+
template: '<p @click="foo">{{ message }}</p>',
|
|
358
|
+
})
|
|
359
|
+
@HasLogger
|
|
360
|
+
class MyComponent {
|
|
361
|
+
@Log
|
|
362
|
+
foo() {
|
|
363
|
+
this.logger.debug('This is MyComponent.foo()');
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
export default toVue(MyComponent);
|
|
368
|
+
</code></pre>
|
|
369
|
+
<p><strong>NOTE</strong>: the order of the decorators is IMPORTANT. The <code>@HasLogger</code> decorator
|
|
370
|
+
must be placed <strong>AFTER</strong> the <code>@Component</code> decorator.</p>
|
|
371
|
+
</div>
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
<dl class="details">
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
<dt class="tag-author">Author:</dt>
|
|
397
|
+
<dd class="tag-author">
|
|
398
|
+
<ul>
|
|
399
|
+
<li>Haixing Hu</li>
|
|
400
|
+
</ul>
|
|
401
|
+
</dd>
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
</dl>
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
|
|
427
|
+
<h5>Parameters:</h5>
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
<table class="params">
|
|
431
|
+
<thead>
|
|
432
|
+
<tr>
|
|
433
|
+
|
|
434
|
+
<th>Name</th>
|
|
435
|
+
|
|
436
|
+
|
|
437
|
+
<th>Type</th>
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
<th class="last">Description</th>
|
|
444
|
+
</tr>
|
|
445
|
+
</thead>
|
|
446
|
+
|
|
447
|
+
<tbody>
|
|
448
|
+
|
|
449
|
+
|
|
450
|
+
<tr>
|
|
451
|
+
|
|
452
|
+
<td class="name"><code>Class</code></td>
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
<td class="type">
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
<span class="param-type"><code>function</code></span>
|
|
459
|
+
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
</td>
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
<td class="description last">
|
|
469
|
+
<p>the target class to be decorated.</p>
|
|
470
|
+
|
|
471
|
+
</td>
|
|
472
|
+
</tr>
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
<tr>
|
|
477
|
+
|
|
478
|
+
<td class="name"><code>context</code></td>
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
<td class="type">
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
<span class="param-type"><code>object</code></span>
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
</td>
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
|
|
494
|
+
<td class="description last">
|
|
495
|
+
<p>the context object containing information about the class to be decorated.</p>
|
|
496
|
+
|
|
497
|
+
</td>
|
|
498
|
+
</tr>
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
</tbody>
|
|
502
|
+
</table>
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
<div class="section-returns">
|
|
520
|
+
<h5>Returns:</h5>
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
<dl class="param-type">
|
|
525
|
+
<dt>
|
|
526
|
+
Type:
|
|
527
|
+
</dt>
|
|
528
|
+
<dd>
|
|
529
|
+
|
|
530
|
+
<span class="param-type"><code>function</code></span>
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
</dd>
|
|
534
|
+
</dl>
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
<div class="param-desc">
|
|
538
|
+
<p>the new constructor of the decorated class.</p>
|
|
539
|
+
</div>
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
</div>
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
</div>
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
<div class="section-method">
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
<h4 class="name" id="Log"><span class="type-signature"></span>Log<span class="signature">(target, context)</span><span class="type-signature"> → {function}</span></h4>
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
|
|
562
|
+
|
|
563
|
+
<div class="description">
|
|
564
|
+
<p>Defines a class method decorator that modifies the target method and prints
|
|
565
|
+
its calling signature in the log, including class name, method name and
|
|
566
|
+
parameters.</p>
|
|
567
|
+
<p>Note that only non-constructor class method can be decorated by this decorator.
|
|
568
|
+
The global function and class constructor CANNOT be decorated by this decorator.</p>
|
|
569
|
+
<p>Usage example:</p>
|
|
570
|
+
<pre class="prettyprint source lang-js"><code>import { Log } from '@haixing_hu/logging';
|
|
571
|
+
|
|
572
|
+
class Person {
|
|
573
|
+
@Log
|
|
574
|
+
eat(meal) {
|
|
575
|
+
...
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const person = new Person();
|
|
580
|
+
const meal = new Meal();
|
|
581
|
+
person.eat(meal); // 日志中将会打印此方法调用的签名
|
|
582
|
+
</code></pre>
|
|
583
|
+
</div>
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
<dl class="details">
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
<dt class="tag-author">Author:</dt>
|
|
609
|
+
<dd class="tag-author">
|
|
610
|
+
<ul>
|
|
611
|
+
<li>Haixing Hu</li>
|
|
612
|
+
</ul>
|
|
613
|
+
</dd>
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
|
|
629
|
+
</dl>
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
<h5>Parameters:</h5>
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
<table class="params">
|
|
643
|
+
<thead>
|
|
644
|
+
<tr>
|
|
645
|
+
|
|
646
|
+
<th>Name</th>
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
<th>Type</th>
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
<th class="last">Description</th>
|
|
656
|
+
</tr>
|
|
657
|
+
</thead>
|
|
658
|
+
|
|
659
|
+
<tbody>
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
<tr>
|
|
663
|
+
|
|
664
|
+
<td class="name"><code>target</code></td>
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
<td class="type">
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
<span class="param-type"><code>function</code></span>
|
|
671
|
+
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
</td>
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
<td class="description last">
|
|
681
|
+
<p>The method being decorated.</p>
|
|
682
|
+
|
|
683
|
+
</td>
|
|
684
|
+
</tr>
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
<tr>
|
|
689
|
+
|
|
690
|
+
<td class="name"><code>context</code></td>
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
<td class="type">
|
|
694
|
+
|
|
695
|
+
|
|
696
|
+
<span class="param-type"><code>object</code></span>
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
</td>
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
<td class="description last">
|
|
707
|
+
<p>the context object containing information about the method to be decorated.</p>
|
|
708
|
+
|
|
709
|
+
</td>
|
|
710
|
+
</tr>
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
</tbody>
|
|
714
|
+
</table>
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
|
|
727
|
+
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
<div class="section-returns">
|
|
732
|
+
<h5>Returns:</h5>
|
|
733
|
+
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
<dl class="param-type">
|
|
737
|
+
<dt>
|
|
738
|
+
Type:
|
|
739
|
+
</dt>
|
|
740
|
+
<dd>
|
|
741
|
+
|
|
742
|
+
<span class="param-type"><code>function</code></span>
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
</dd>
|
|
746
|
+
</dl>
|
|
747
|
+
|
|
748
|
+
|
|
749
|
+
<div class="param-desc">
|
|
750
|
+
<p>The decorated method.</p>
|
|
751
|
+
</div>
|
|
752
|
+
|
|
753
|
+
|
|
754
|
+
</div>
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
</div>
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
</article>
|
|
768
|
+
|
|
769
|
+
</section>
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
</div>
|
|
775
|
+
|
|
776
|
+
<br class="clear">
|
|
777
|
+
|
|
778
|
+
<footer>
|
|
779
|
+
Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.4</a>
|
|
780
|
+
on Sun Jan 05 2025 14:29:26 GMT+0800 (China Standard Time)
|
|
781
|
+
using the <a href="https://github.com/Haixing-Hu/jsdoc-minami">customized Minami theme</a>.
|
|
782
|
+
</footer>
|
|
783
|
+
|
|
784
|
+
<script>prettyPrint();</script>
|
|
785
|
+
<script src="scripts/linenumber.js"></script>
|
|
786
|
+
</body>
|
|
787
|
+
</html>
|