1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
18 | return new (P || (P = Promise))(function (resolve, reject) {
|
19 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21 | function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
|
22 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23 | });
|
24 | };
|
25 | Object.defineProperty(exports, "__esModule", { value: true });
|
26 | const automation_client_1 = require("@atomist/automation-client");
|
27 | const EphemeralProgressLog_1 = require("@atomist/sdm/api-helper/log/EphemeralProgressLog");
|
28 | const firstAvailableProgressLog_1 = require("@atomist/sdm/api-helper/log/firstAvailableProgressLog");
|
29 | const LoggingProgressLog_1 = require("@atomist/sdm/api-helper/log/LoggingProgressLog");
|
30 | const WriteToAllProgressLog_1 = require("@atomist/sdm/api-helper/log/WriteToAllProgressLog");
|
31 | const DashboardDisplayProgressLog_1 = require("./DashboardDisplayProgressLog");
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | function rolarAndDashboardLogFactory(rolarBaseUrl, bufferSize = 1000, flushInterval = 2000) {
|
40 | let persistentLogFactory = (context, sdmGoal, fallback) => firstAvailableProgressLog_1.firstAvailableProgressLog(fallback);
|
41 | if (rolarBaseUrl) {
|
42 | automation_client_1.logger.info("Logging with Rolar: " + rolarBaseUrl);
|
43 | persistentLogFactory = (context, sdmGoal, fallback) => {
|
44 | return firstAvailableProgressLog_1.firstAvailableProgressLog(new DashboardDisplayProgressLog_1.DashboardDisplayProgressLog(rolarBaseUrl, bufferSize, flushInterval, context, sdmGoal), fallback);
|
45 | };
|
46 | }
|
47 | return (context, sdmGoal) => __awaiter(this, void 0, void 0, function* () {
|
48 | const name = sdmGoal.name;
|
49 | const persistentLog = yield persistentLogFactory(context, sdmGoal, new LoggingProgressLog_1.LoggingProgressLog(name, "info"));
|
50 | return new WriteToAllProgressLog_1.WriteToAllProgressLog(name, yield EphemeralProgressLog_1.createEphemeralProgressLog(context, sdmGoal), persistentLog);
|
51 | });
|
52 | }
|
53 | exports.rolarAndDashboardLogFactory = rolarAndDashboardLogFactory;
|
54 |
|
\ | No newline at end of file |