@canopycanopycanopy/b-ber-logger 3.0.8-nav-memo.4 → 3.0.8-next.61
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/README.md +28 -55
- package/dist/index.js +4 -4
- package/dist/summary.js +3 -3
- package/package.json +3 -7
package/README.md
CHANGED
|
@@ -1,58 +1,31 @@
|
|
|
1
1
|
# `@canopycanopycanopy/b-ber-logger`
|
|
2
2
|
|
|
3
|
-
`b-ber-logger` is b-ber
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
$ bber build --warn
|
|
32
|
-
$ bber build --log-level=1
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
#### `--error`
|
|
36
|
-
|
|
37
|
-
The `--error` flag will emit warnings and stack traces for errors to the console and is an alias of `loglevel=2`.
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
$ bber build --error
|
|
41
|
-
$ bber build --log-level=2
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
#### `--verbose`
|
|
45
|
-
|
|
46
|
-
The `--verbose` flat will emit messages, warnings, errors and stack traces to the console.
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
$ bber build --verbose
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
#### `--debug`
|
|
53
|
-
|
|
54
|
-
The `--debug` flag will emit stack traces for everything, as well as warnings and errors to the console.
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
$ bber build --debug
|
|
3
|
+
`b-ber-logger` is the logging utility for the b-ber build pipeline. It exports a single `Logger` singleton (`log`) that all other packages import instead of using `console.log` directly. The logger supports levelled output (`info`, `warn`, `error`, `debug`, `trace`, `notice`, `inspect`), chalk-coloured formatting, indentation tracking across nested task steps, a build-run timer, end-of-run summary of collected warnings and errors, and quiet/verbose/debug modes driven by CLI flags (`--quiet`, `--verbose`, `--debug`, `--log-level=N`).
|
|
4
|
+
|
|
5
|
+
## Key exports
|
|
6
|
+
|
|
7
|
+
| Export | Purpose |
|
|
8
|
+
| --------------- | ------------------------------------------------------------- |
|
|
9
|
+
| `log` (default) | Singleton `Logger` instance; import and call methods directly |
|
|
10
|
+
|
|
11
|
+
### Logger methods
|
|
12
|
+
|
|
13
|
+
| Method | Purpose |
|
|
14
|
+
| ------------------------- | -------------------------------------------------- |
|
|
15
|
+
| `log.info(msg)` | Standard informational output |
|
|
16
|
+
| `log.warn(msg)` | Warning, collected for end-of-run summary |
|
|
17
|
+
| `log.error(msg)` | Error output, collected for end-of-run summary |
|
|
18
|
+
| `log.debug(msg)` | Debug output; enabled by `--debug` flag |
|
|
19
|
+
| `log.trace(msg)` | Trace-level output |
|
|
20
|
+
| `log.notice(msg)` | Notice-level output |
|
|
21
|
+
| `log.inspect(val)` | Pretty-prints objects |
|
|
22
|
+
| `log.printSummary()` | Prints collected warnings/errors at end of a build |
|
|
23
|
+
| `log.configure(opts)` | Applies settings (logLevel, boringOutput, etc.) |
|
|
24
|
+
| `log.registerSequence(n)` | Sets total task count for progress display |
|
|
25
|
+
|
|
26
|
+
## Dev
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm test # jest
|
|
30
|
+
npm run build
|
|
58
31
|
```
|
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
12
12
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
13
13
|
var _keys = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/keys"));
|
|
14
14
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var _has = _interopRequireDefault(require("lodash/has"));
|
|
16
|
+
var _isUndefined = _interopRequireDefault(require("lodash/isUndefined"));
|
|
17
17
|
var _Timer = _interopRequireDefault(require("./Timer"));
|
|
18
18
|
var _printer = require("./printer");
|
|
19
19
|
var _indenter = require("./indenter");
|
|
@@ -95,12 +95,12 @@ class Logger extends _Timer.default {
|
|
|
95
95
|
const argv = (0, _reduce.default)(_context = process.argv).call(_context, (acc, curr) => {
|
|
96
96
|
const [k, v] = curr.split('=');
|
|
97
97
|
// eslint-disable-next-line no-restricted-globals
|
|
98
|
-
acc[k] = (0,
|
|
98
|
+
acc[k] = (0, _isUndefined.default)(v) ? true : !isNaN(v) ? Number(v) : v;
|
|
99
99
|
return acc;
|
|
100
100
|
}, {});
|
|
101
101
|
(0, _forEach.default)(_context2 = (0, _keys.default)(this.settings)).call(_context2, a => {
|
|
102
102
|
const opt = `--${a}`;
|
|
103
|
-
if ((0,
|
|
103
|
+
if ((0, _has.default)(argv, opt)) this.settings[a] = argv[opt];
|
|
104
104
|
});
|
|
105
105
|
this.configure();
|
|
106
106
|
(0, _bind.default)(_context3 = this).call(_context3);
|
package/dist/summary.js
CHANGED
|
@@ -11,7 +11,7 @@ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable
|
|
|
11
11
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
12
12
|
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
13
13
|
var _util = _interopRequireDefault(require("util"));
|
|
14
|
-
var
|
|
14
|
+
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
|
|
15
15
|
/* eslint-disable import/prefer-default-export */
|
|
16
16
|
|
|
17
17
|
const INDENTATION = ' ';
|
|
@@ -39,7 +39,7 @@ function printNavigation(data, context, indent = 0) {
|
|
|
39
39
|
function writeMetadata(data, context) {
|
|
40
40
|
var _context3;
|
|
41
41
|
(0, _forEach.default)(_context3 = (0, _entries.default)(data)).call(_context3, ([, v]) => {
|
|
42
|
-
if ((0,
|
|
42
|
+
if ((0, _isPlainObject.default)(v)) {
|
|
43
43
|
write([[`${v.term}: ${v.value}`]], context);
|
|
44
44
|
}
|
|
45
45
|
});
|
|
@@ -51,7 +51,7 @@ function writeConfig(data, context, indent = 0) {
|
|
|
51
51
|
if (typeof v === 'string') {
|
|
52
52
|
write([[`${indent_}${k}: ${v}`]], context);
|
|
53
53
|
}
|
|
54
|
-
if ((0,
|
|
54
|
+
if ((0, _isPlainObject.default)(v)) {
|
|
55
55
|
write([[`${indent_}${k}`]], context);
|
|
56
56
|
writeConfig(v, context, indent + 1);
|
|
57
57
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-logger",
|
|
3
|
-
"version": "3.0.8-
|
|
3
|
+
"version": "3.0.8-next.61+2bbec564",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,11 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"chalk": "^2.1.0",
|
|
21
|
-
"lodash": "^4.17.21"
|
|
22
|
-
"lodash.has": "latest",
|
|
23
|
-
"lodash.isplainobject": "latest",
|
|
24
|
-
"lodash.isundefined": "^3.0.1",
|
|
25
|
-
"tar": "^6.1.11"
|
|
21
|
+
"lodash": "^4.17.21"
|
|
26
22
|
},
|
|
27
23
|
"devDependencies": {
|
|
28
24
|
"@babel/cli": "^7.10.5",
|
|
@@ -49,5 +45,5 @@
|
|
|
49
45
|
"url": "https://maxwellsimmer.com"
|
|
50
46
|
}
|
|
51
47
|
],
|
|
52
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "2bbec5643278f53becb0d2ba1f55edfe379d5587"
|
|
53
49
|
}
|