build, deploy: Improve logging of image build messages

Change-type: patch
This commit is contained in:
Paulo Castro 2021-09-17 16:27:44 +01:00 committed by toochevere
parent ffccbfba12
commit 8bb211e441
4 changed files with 30 additions and 7 deletions

View File

@ -1051,6 +1051,7 @@ export async function makeBuildTasks(
infoStr = `build [${task.context}]`;
}
logger.logDebug(` ${task.serviceName}: ${infoStr}`);
task.logger = logger.getAdapter();
});
logger.logDebug(

View File

@ -30,6 +30,14 @@ enum Level {
LIVEPUSH = 'livepush',
}
interface LoggerAdapter {
debug: (msg: string) => void;
error: (msg: string) => void;
info: (msg: string) => void;
log: (msg: string) => void;
warn: (msg: string) => void;
}
/**
* General purpose logger class with support for log streams and colours.
* Call `Logger.getLogger()` to retrieve a global shared instance of this
@ -57,6 +65,8 @@ class Logger {
protected deferredLogMessages: Array<[string, Level]>;
protected adapter: LoggerAdapter;
protected constructor() {
const logger = new StreamLogger();
const chalk = getChalk();
@ -91,6 +101,14 @@ class Logger {
this.formatMessage = logger.formatWithPrefix.bind(logger);
this.deferredLogMessages = [];
this.adapter = {
debug: (msg: string) => this.logDebug(msg),
error: (msg: string) => this.logError(msg),
info: (msg: string) => this.logInfo(msg),
log: (msg: string) => this.logLogs(msg),
warn: (msg: string) => this.logWarn(msg),
};
}
protected static logger: Logger;
@ -151,6 +169,10 @@ class Logger {
});
this.deferredLogMessages = [];
}
public getAdapter(): LoggerAdapter {
return this.adapter;
}
}
export = Logger;

12
npm-shrinkwrap.json generated
View File

@ -8210,9 +8210,9 @@
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fp-ts": {
"version": "2.11.2",
"resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.11.2.tgz",
"integrity": "sha512-G1rD89nmbbgTNRBKohjB3Qv4IxOHQ5KV3ZvYfpaQZyrGt+ZQUFrcnCqE567bcEdvwoAUKDQM7isOcv7xcM/qAQ=="
"version": "2.11.3",
"resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.11.3.tgz",
"integrity": "sha512-qHI5iaVSFNFmdl6yDensWfFMk32iafAINCnqx8m486DV1+Jht/bTnA9CyahL+Xm7h2y3erinviVBIAWvv5bPYw=="
},
"fragment-cache": {
"version": "0.2.1",
@ -15766,9 +15766,9 @@
}
},
"resin-multibuild": {
"version": "4.12.1",
"resolved": "https://registry.npmjs.org/resin-multibuild/-/resin-multibuild-4.12.1.tgz",
"integrity": "sha512-ORtzaDZGS5wftNo4KXi4yOcqSsjU0/56oY7mXlc8XcmqusOOfr1N3rnFpXkjQ7COJLcPvfPT+OEeJuQ7l7cOmg==",
"version": "4.12.2",
"resolved": "https://registry.npmjs.org/resin-multibuild/-/resin-multibuild-4.12.2.tgz",
"integrity": "sha512-FkRqGEM588wA6v03pQbodPqWQdAs6aMh+GWvYQBz5IxqSVecn4FLHaRE0pF6VFKtjf/XBuPw7dtqiFzH+NIz5g==",
"requires": {
"ajv": "^6.12.3",
"bluebird": "^3.7.2",

View File

@ -268,7 +268,7 @@
"resin-cli-visuals": "^1.8.0",
"resin-compose-parse": "^2.1.3",
"resin-doodles": "^0.1.1",
"resin-multibuild": "^4.12.1",
"resin-multibuild": "4.12.2",
"resin-stream-logger": "^0.1.2",
"rimraf": "^3.0.2",
"semver": "^7.3.2",