standard-log 6.1.2 → 6.2.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/CHANGELOG.md CHANGED
@@ -3,6 +3,47 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 6.2.2 (2022-01-02)
7
+
8
+ **Note:** Version bump only for package standard-log
9
+
10
+
11
+
12
+
13
+
14
+ ## 6.2.1 (2021-05-21)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * update tslib ([#110](https://github.com/unional/standard-log/issues/110)) ([2d7a0d2](https://github.com/unional/standard-log/commit/2d7a0d200d442794d7152aa284a65c00e0840bd7))
20
+
21
+
22
+
23
+
24
+
25
+ # 6.2.0 (2021-05-12)
26
+
27
+
28
+ ### Features
29
+
30
+ * add configForTest() ([#109](https://github.com/unional/standard-log/issues/109)) ([9170b29](https://github.com/unional/standard-log/commit/9170b2976896b5f0bf577480ee72ec3d9b64a836))
31
+
32
+
33
+
34
+
35
+
36
+ ## 6.1.3 (2021-04-30)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * diable destructuring ([#108](https://github.com/unional/standard-log/issues/108)) ([664d33a](https://github.com/unional/standard-log/commit/664d33ae3e499b5cde2c1a9d409730a8e38b261f))
42
+
43
+
44
+
45
+
46
+
6
47
  ## 6.1.2 (2021-04-30)
7
48
 
8
49
 
package/README.md CHANGED
@@ -188,6 +188,40 @@ To use it, you also need to load [`global-store`](https://github.com/unional/glo
188
188
  If you are building a library and bundle it, make sure you mark `global-store` as externals.
189
189
  You can check out [`global-store`](https://github.com/unional/global-store) for more information.
190
190
 
191
+ ## testing
192
+
193
+ During test,
194
+ you should configure `standard-log` to `test` mode and use `MemoryReporter` to capture the logs.
195
+
196
+ ```ts
197
+ import { config, createMemoryReporter } from 'standard-log'
198
+
199
+ test('your test', () => {
200
+ const reporter = createMemoryLogReporter()
201
+ config({
202
+ reporters: [reporter],
203
+ mode: 'test'
204
+ })
205
+
206
+ // do your thing...
207
+
208
+ const messages = reporter.getLogMessage() // or getLogMessageWithLevel()
209
+ // validate the message if you want to
210
+ })
211
+ ```
212
+
213
+ And to simplify things, you can use the `configForTest()` function:
214
+
215
+ ```ts
216
+ import { configForTest } from 'standard-log'
217
+
218
+ test('your test', () => {
219
+ const { reporter } = configForTest()
220
+
221
+ // do your thing...
222
+ })
223
+ ```
224
+
191
225
  [npm-image]: https://img.shields.io/npm/v/standard-log.svg?style=flat
192
226
  [npm-url]: https://www.npmjs.com/package/standard-log
193
227
  [downloads-image]: https://img.shields.io/npm/dm/standard-log.svg?style=flat
@@ -1113,6 +1113,32 @@ Object.defineProperty(exports.config, 'isLocked', {
1113
1113
  });
1114
1114
 
1115
1115
 
1116
+ /***/ }),
1117
+
1118
+ /***/ "./src/configForTest.ts":
1119
+ /*!******************************!*\
1120
+ !*** ./src/configForTest.ts ***!
1121
+ \******************************/
1122
+ /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
1123
+
1124
+ "use strict";
1125
+
1126
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
1127
+ exports.configForTest = void 0;
1128
+ var config_1 = __webpack_require__(/*! ./config */ "./src/config.ts");
1129
+ var memory_1 = __webpack_require__(/*! ./memory */ "./src/memory/index.ts");
1130
+ function configForTest(logLevel) {
1131
+ var reporter = memory_1.createMemoryLogReporter();
1132
+ config_1.config({
1133
+ reporters: [reporter],
1134
+ mode: 'test',
1135
+ logLevel: logLevel
1136
+ });
1137
+ return { reporter: reporter };
1138
+ }
1139
+ exports.configForTest = configForTest;
1140
+
1141
+
1116
1142
  /***/ }),
1117
1143
 
1118
1144
  /***/ "./src/console/createConsoleLogReporter.ts":
@@ -1775,6 +1801,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
1775
1801
  Object.defineProperty(exports, "__esModule", ({ value: true }));
1776
1802
  __exportStar(__webpack_require__(/*! ./captureLogs */ "./src/captureLogs.ts"), exports);
1777
1803
  __exportStar(__webpack_require__(/*! ./config */ "./src/config.ts"), exports);
1804
+ __exportStar(__webpack_require__(/*! ./configForTest */ "./src/configForTest.ts"), exports);
1778
1805
  __exportStar(__webpack_require__(/*! ./console */ "./src/console/index.ts"), exports);
1779
1806
  __exportStar(__webpack_require__(/*! ./customLogLevel */ "./src/customLogLevel.ts"), exports);
1780
1807
  __exportStar(__webpack_require__(/*! ./errors */ "./src/errors.ts"), exports);
Binary file