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:
@@ -119,7 +119,7 @@ function upload(apiConfig, backupFilePath, sourceStream, callback) {
|
||||
});
|
||||
|
||||
fileStream.on('error', function (error) {
|
||||
debug('[%s] upload: out stream error.', backupFilePath, error);
|
||||
debug(`upload: [${backupFilePath}] out stream error. %o`, error);
|
||||
callback(new BoxError(BoxError.EXTERNAL_ERROR, error.message));
|
||||
});
|
||||
|
||||
@@ -131,7 +131,7 @@ function upload(apiConfig, backupFilePath, sourceStream, callback) {
|
||||
if (!safe.fs.chownSync(path.dirname(backupFilePath), backupUid, backupUid)) return callback(new BoxError(BoxError.EXTERNAL_ERROR, 'Unable to chown:' + safe.error.message));
|
||||
}
|
||||
|
||||
debug('upload %s: done.', backupFilePath);
|
||||
debug(`upload ${backupFilePath}: done`);
|
||||
|
||||
callback(null);
|
||||
});
|
||||
@@ -187,7 +187,7 @@ function listDir(apiConfig, dir, batchSize, iteratorCallback, callback) {
|
||||
});
|
||||
});
|
||||
entryStream.on('warn', function (error) {
|
||||
debug('listDir: warning ', error);
|
||||
debug('listDir: warning. %o', error);
|
||||
});
|
||||
entryStream.on('end', function () {
|
||||
iteratorCallback(entries, callback);
|
||||
|
||||
@@ -94,7 +94,7 @@ function upload(apiConfig, backupFilePath, sourceStream, callback) {
|
||||
|
||||
function done(error) {
|
||||
if (error) {
|
||||
debug('[%s] upload: gcp upload error.', backupFilePath, error);
|
||||
debug(`upload: [${backupFilePath}] gcp upload error. %o`, error);
|
||||
return callback(new BoxError(BoxError.EXTERNAL_ERROR, `Error uploading ${backupFilePath}. Message: ${error.message} HTTP Code: ${error.code}`));
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ function download(apiConfig, backupFilePath, callback) {
|
||||
if (error && error.code == 404){
|
||||
ps.emit('error', new BoxError(BoxError.NOT_FOUND));
|
||||
} else {
|
||||
debug('[%s] download: gcp stream error.', backupFilePath, error);
|
||||
debug(`download: [${backupFilePath}] gcp stream error. %o`, error);
|
||||
ps.emit('error', new BoxError(BoxError.EXTERNAL_ERROR, error));
|
||||
}
|
||||
})
|
||||
@@ -200,7 +200,7 @@ async function copy(apiConfig, oldFilePath, newFilePath, progressCallback) {
|
||||
var relativePath = path.relative(oldFilePath, entry.fullPath);
|
||||
|
||||
getBucket(apiConfig).file(entry.fullPath).copy(path.join(newFilePath, relativePath), function(error) {
|
||||
if (error) debug('copyBackup: gcs copy error', error);
|
||||
if (error) debug('copyBackup: gcs copy error. %o', error);
|
||||
|
||||
if (error && error.code === 404) return iteratorCallback(new BoxError(BoxError.NOT_FOUND, 'Old backup not found'));
|
||||
if (error) return iteratorCallback(new BoxError(BoxError.EXTERNAL_ERROR, error.message));
|
||||
@@ -278,7 +278,7 @@ async function testConfig(apiConfig) {
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
uploadStream.on('error', function(error) {
|
||||
debug('testConfig: failed uploading cloudron-testfile', error);
|
||||
debug('testConfig: failed uploading cloudron-testfile. %o', error);
|
||||
if (error && error.code && (error.code == 403 || error.code == 404)) {
|
||||
return reject(new BoxError(BoxError.BAD_FIELD, error.message));
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ function upload(apiConfig, backupFilePath, sourceStream, callback) {
|
||||
|
||||
s3.upload(params, { partSize, queueSize: 3 }, function (error, data) {
|
||||
if (error) {
|
||||
debug('Error uploading [%s]: s3 upload error.', backupFilePath, error);
|
||||
debug(`upload: [${backupFilePath}] s3 upload error. %o`, error);
|
||||
return callback(new BoxError(BoxError.EXTERNAL_ERROR, `Error uploading ${backupFilePath}. Message: ${error.message} HTTP Code: ${error.code}`));
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ class S3MultipartDownloadStream extends Readable {
|
||||
if (S3_NOT_FOUND(error)) {
|
||||
this.destroy(new BoxError(BoxError.NOT_FOUND, `Backup not found: ${this._path}`));
|
||||
} else {
|
||||
debug(`download: ${this._path} s3 stream error.`, error);
|
||||
debug(`download: ${this._path} s3 stream error. %o`, error);
|
||||
this.destroy(new BoxError(BoxError.EXTERNAL_ERROR, `Error multipartDownload ${this._path}. Message: ${error.message} HTTP Code: ${error.code}`));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user