logs: use %o to format error

otherwise, they are printed as multi-line and this messes up tail+date formatting
This commit is contained in:
Girish Ramakrishnan
2023-04-16 10:49:59 +02:00
parent e6f870b220
commit c4f4f3e914
29 changed files with 70 additions and 73 deletions

View File

@@ -185,7 +185,7 @@ async function cleanupLogs(app) {
// note that redis container logs are cleaned up by the addon
const [error] = await safe(fs.promises.rm(path.join(paths.LOG_DIR, app.id), { force: true, recursive: true }));
if (error) debug('cleanupLogs: cannot cleanup logs:', error);
if (error) debug('cleanupLogs: cannot cleanup logs: %o', error);
}
async function verifyManifest(manifest) {
@@ -627,7 +627,7 @@ async function update(app, args, progressCallback) {
if (newTcpPorts[portName] || newUdpPorts[portName]) continue; // port still in use
const [error] = await safe(apps.delPortBinding(currentPorts[portName], apps.PORT_TYPE_TCP));
if (error && error.reason === BoxError.NOT_FOUND) debug('update: portbinding does not exist in database', error);
if (error && error.reason === BoxError.NOT_FOUND) debug('update: portbinding does not exist in database: %o', error);
else if (error) throw error;
// also delete from app object for further processing (the db is updated in the next step)
@@ -804,7 +804,7 @@ async function run(appId, args, progressCallback) {
const [error, result] = await safe(cmd); // only some commands like backup return a result
if (error) {
debug(`run: app error for state ${app.installationState}:`, error);
debug(`run: app error for state ${app.installationState}: %o`, error);
if (app.installationState === apps.ISTATE_PENDING_BACKUP) {
// return to installed state intentionally. the error is stashed only in the task and not the app (the UI shows error state otherwise)