@lage-run/reporters 1.1.2 → 1.2.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.json +42 -1
- package/CHANGELOG.md +17 -2
- package/lib/VerboseFileLogReporter.d.ts +14 -0
- package/lib/VerboseFileLogReporter.js +91 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -1
- package/package.json +6 -4
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,48 @@
|
|
|
2
2
|
"name": "@lage-run/reporters",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Tue, 25 Apr 2023 02:50:56 GMT",
|
|
6
|
+
"tag": "@lage-run/reporters_v1.2.0",
|
|
7
|
+
"version": "1.2.0",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "elcraig@microsoft.com",
|
|
12
|
+
"package": "@lage-run/reporters",
|
|
13
|
+
"commit": "a2e112e8aafee26380684efca4db994a9c5e3801",
|
|
14
|
+
"comment": "Update repository and homepage"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"minor": [
|
|
18
|
+
{
|
|
19
|
+
"author": "stchur@microsoft.com",
|
|
20
|
+
"package": "@lage-run/reporters",
|
|
21
|
+
"commit": "a2e112e8aafee26380684efca4db994a9c5e3801",
|
|
22
|
+
"comment": "Add VerboseFileLogReporter, which writes verbose, ungrouped logs to a file"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"author": "beachball",
|
|
26
|
+
"package": "@lage-run/reporters",
|
|
27
|
+
"comment": "Bump @lage-run/logger to v1.3.0",
|
|
28
|
+
"commit": "a2e112e8aafee26380684efca4db994a9c5e3801"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"author": "beachball",
|
|
32
|
+
"package": "@lage-run/reporters",
|
|
33
|
+
"comment": "Bump @lage-run/scheduler-types to v0.3.8",
|
|
34
|
+
"commit": "a2e112e8aafee26380684efca4db994a9c5e3801"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"author": "beachball",
|
|
38
|
+
"package": "@lage-run/reporters",
|
|
39
|
+
"comment": "Bump @lage-run/target-graph to v0.8.4",
|
|
40
|
+
"commit": "a2e112e8aafee26380684efca4db994a9c5e3801"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"date": "Fri, 14 Apr 2023 04:37:55 GMT",
|
|
6
47
|
"tag": "@lage-run/reporters_v1.1.2",
|
|
7
48
|
"version": "1.1.2",
|
|
8
49
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,27 @@
|
|
|
1
1
|
# Change Log - @lage-run/reporters
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 25 Apr 2023 02:50:56 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.2.0
|
|
8
|
+
|
|
9
|
+
Tue, 25 Apr 2023 02:50:56 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Add VerboseFileLogReporter, which writes verbose, ungrouped logs to a file (stchur@microsoft.com)
|
|
14
|
+
- Bump @lage-run/logger to v1.3.0
|
|
15
|
+
- Bump @lage-run/scheduler-types to v0.3.8
|
|
16
|
+
- Bump @lage-run/target-graph to v0.8.4
|
|
17
|
+
|
|
18
|
+
### Patches
|
|
19
|
+
|
|
20
|
+
- Update repository and homepage (elcraig@microsoft.com)
|
|
21
|
+
|
|
7
22
|
## 1.1.2
|
|
8
23
|
|
|
9
|
-
Fri, 14 Apr 2023 04:37:
|
|
24
|
+
Fri, 14 Apr 2023 04:37:55 GMT
|
|
10
25
|
|
|
11
26
|
### Patches
|
|
12
27
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { Reporter, LogEntry } from "@lage-run/logger";
|
|
3
|
+
import { Writable } from "stream";
|
|
4
|
+
export declare class VerboseFileLogReporter implements Reporter {
|
|
5
|
+
fileStream: Writable;
|
|
6
|
+
constructor(logFile?: string);
|
|
7
|
+
cleanup(): void;
|
|
8
|
+
log(entry: LogEntry<any>): void;
|
|
9
|
+
private printEntry;
|
|
10
|
+
private getEntryTargetId;
|
|
11
|
+
private print;
|
|
12
|
+
private logTargetEntry;
|
|
13
|
+
summarize(): void;
|
|
14
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "VerboseFileLogReporter", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: ()=>VerboseFileLogReporter
|
|
8
|
+
});
|
|
9
|
+
const _formatHrtime = require("@lage-run/format-hrtime");
|
|
10
|
+
const _isTargetStatusLogEntryJs = require("./isTargetStatusLogEntry.js");
|
|
11
|
+
const _logger = require("@lage-run/logger");
|
|
12
|
+
const _ansiRegex = /*#__PURE__*/ _interopRequireDefault(require("ansi-regex"));
|
|
13
|
+
const _stream = require("stream");
|
|
14
|
+
const _fs = /*#__PURE__*/ _interopRequireDefault(require("fs"));
|
|
15
|
+
function _interopRequireDefault(obj) {
|
|
16
|
+
return obj && obj.__esModule ? obj : {
|
|
17
|
+
default: obj
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
const stripAnsiRegex = (0, _ansiRegex.default)();
|
|
21
|
+
function stripAnsi(message) {
|
|
22
|
+
return message.replace(stripAnsiRegex, "");
|
|
23
|
+
}
|
|
24
|
+
class VerboseFileLogReporter {
|
|
25
|
+
cleanup() {
|
|
26
|
+
this.fileStream?.end();
|
|
27
|
+
}
|
|
28
|
+
log(entry) {
|
|
29
|
+
// if "hidden", do not even attempt to record or report the entry
|
|
30
|
+
if (entry?.data?.target?.hidden) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
// if loglevel is not high enough, do not report the entry
|
|
34
|
+
if (_logger.LogLevel.verbose < entry.level) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
// log normal target entries
|
|
38
|
+
if (entry.data && entry.data.target) {
|
|
39
|
+
return this.logTargetEntry(entry);
|
|
40
|
+
}
|
|
41
|
+
// log generic entries (not related to target)
|
|
42
|
+
if (entry.msg) {
|
|
43
|
+
return this.print(`${entry.msg}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
printEntry(entry, message) {
|
|
47
|
+
let packageAndTask = "";
|
|
48
|
+
if (entry?.data?.target) {
|
|
49
|
+
const { packageName , task } = entry.data.target;
|
|
50
|
+
const pkg = packageName ?? "<root>";
|
|
51
|
+
packageAndTask = `${pkg} ${task}`.trim();
|
|
52
|
+
}
|
|
53
|
+
this.print(`${this.getEntryTargetId(entry)} ${packageAndTask} ${message}`.trim());
|
|
54
|
+
}
|
|
55
|
+
getEntryTargetId(entry) {
|
|
56
|
+
if (entry.data?.target?.id) {
|
|
57
|
+
return `[:${entry.data.target.id}:]`;
|
|
58
|
+
}
|
|
59
|
+
return "";
|
|
60
|
+
}
|
|
61
|
+
print(message) {
|
|
62
|
+
this.fileStream?.write(message + "\n");
|
|
63
|
+
}
|
|
64
|
+
logTargetEntry(entry) {
|
|
65
|
+
const data = entry.data;
|
|
66
|
+
if ((0, _isTargetStatusLogEntryJs.isTargetStatusLogEntry)(data)) {
|
|
67
|
+
const { hash , duration , status } = data;
|
|
68
|
+
const statusMessages = {
|
|
69
|
+
running: "➔ start",
|
|
70
|
+
success: `✓ done - ${duration && (0, _formatHrtime.formatDuration)((0, _formatHrtime.hrToSeconds)(duration))}`,
|
|
71
|
+
failed: "✖ fail",
|
|
72
|
+
skipped: `» skip - ${hash}`,
|
|
73
|
+
aborted: "- aborted",
|
|
74
|
+
queued: "… queued"
|
|
75
|
+
};
|
|
76
|
+
return this.printEntry(entry, statusMessages[status]);
|
|
77
|
+
} else {
|
|
78
|
+
const defaultMessage = `: ${stripAnsi(entry.msg)}`;
|
|
79
|
+
return this.printEntry(entry, defaultMessage);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
summarize() {
|
|
83
|
+
// No summary needed for VerboseFileLogReporter
|
|
84
|
+
}
|
|
85
|
+
constructor(logFile){
|
|
86
|
+
// if logFile is falsy (not specified on cli args), this.fileStream just become a "nowhere" stream and this reporter effectively does nothing
|
|
87
|
+
this.fileStream = logFile ? _fs.default.createWriteStream(logFile) : new _stream.Writable({
|
|
88
|
+
write () {}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
package/lib/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { JsonReporter } from "./JsonReporter.js";
|
|
|
3
3
|
export { LogReporter } from "./LogReporter.js";
|
|
4
4
|
export { ChromeTraceEventsReporter } from "./ChromeTraceEventsReporter.js";
|
|
5
5
|
export { ProgressReporter } from "./ProgressReporter.js";
|
|
6
|
+
export { VerboseFileLogReporter } from "./VerboseFileLogReporter.js";
|
|
6
7
|
export type { TargetStatusEntry, TargetMessageEntry } from "./types/TargetLogEntry.js";
|
package/lib/index.js
CHANGED
|
@@ -13,10 +13,12 @@ _export(exports, {
|
|
|
13
13
|
JsonReporter: ()=>_jsonReporterJs.JsonReporter,
|
|
14
14
|
LogReporter: ()=>_logReporterJs.LogReporter,
|
|
15
15
|
ChromeTraceEventsReporter: ()=>_chromeTraceEventsReporterJs.ChromeTraceEventsReporter,
|
|
16
|
-
ProgressReporter: ()=>_progressReporterJs.ProgressReporter
|
|
16
|
+
ProgressReporter: ()=>_progressReporterJs.ProgressReporter,
|
|
17
|
+
VerboseFileLogReporter: ()=>_verboseFileLogReporterJs.VerboseFileLogReporter
|
|
17
18
|
});
|
|
18
19
|
const _adoReporterJs = require("./AdoReporter.js");
|
|
19
20
|
const _jsonReporterJs = require("./JsonReporter.js");
|
|
20
21
|
const _logReporterJs = require("./LogReporter.js");
|
|
21
22
|
const _chromeTraceEventsReporterJs = require("./ChromeTraceEventsReporter.js");
|
|
22
23
|
const _progressReporterJs = require("./ProgressReporter.js");
|
|
24
|
+
const _verboseFileLogReporterJs = require("./VerboseFileLogReporter.js");
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lage-run/reporters",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Log reporters for Lage",
|
|
5
5
|
"repository": {
|
|
6
|
+
"type": "git",
|
|
6
7
|
"url": "https://github.com/microsoft/lage"
|
|
7
8
|
},
|
|
9
|
+
"homepage": "https://microsoft.github.io/lage/",
|
|
8
10
|
"license": "MIT",
|
|
9
11
|
"main": "lib/index.js",
|
|
10
12
|
"types": "lib/index.d.ts",
|
|
@@ -15,9 +17,9 @@
|
|
|
15
17
|
"lint": "monorepo-scripts lint"
|
|
16
18
|
},
|
|
17
19
|
"dependencies": {
|
|
18
|
-
"@lage-run/logger": "^1.
|
|
19
|
-
"@lage-run/scheduler-types": "^0.3.
|
|
20
|
-
"@lage-run/target-graph": "^0.8.
|
|
20
|
+
"@lage-run/logger": "^1.3.0",
|
|
21
|
+
"@lage-run/scheduler-types": "^0.3.8",
|
|
22
|
+
"@lage-run/target-graph": "^0.8.4",
|
|
21
23
|
"@lage-run/format-hrtime": "^0.1.4",
|
|
22
24
|
"@ms-cloudpack/task-reporter": "^0.3.2",
|
|
23
25
|
"chalk": "^4.0.0",
|