SYNC: Merge pull request #7 from dbgate/feature/applog

This commit is contained in:
Jan Prochazka
2025-08-05 17:13:33 +02:00
committed by Diflow
parent ac0aebd751
commit a96f1d0b49
83 changed files with 1014 additions and 242 deletions

View File

@@ -32,15 +32,15 @@ function createBulkInsertStream(driver, stream, dbhan, name, options) {
writable.checkStructure = async () => {
try {
if (options.dropIfExists) {
logger.info(`Dropping collection ${collectionName}`);
logger.info(`DBGM-00137 Dropping collection ${collectionName}`);
await db.collection(collectionName).drop();
}
if (options.truncate) {
logger.info(`Truncating collection ${collectionName}`);
logger.info(`DBGM-00138 Truncating collection ${collectionName}`);
await db.collection(collectionName).deleteMany({});
}
} catch (err) {
logger.error(extractErrorLogData(err), 'Error during preparing mongo bulk insert collection, stopped');
logger.error(extractErrorLogData(err), 'DBGM-00139 Error during preparing mongo bulk insert collection, stopped');
writable.destroy(err);
}
};
@@ -52,7 +52,7 @@ function createBulkInsertStream(driver, stream, dbhan, name, options) {
await db.collection(collectionName).insertMany(rows);
} catch (err) {
logger.error(extractErrorLogData(err), 'Error bulk insert collection, stopped');
logger.error(extractErrorLogData(err), 'DBGM-00197 Error bulk insert collection, stopped');
writable.destroy(err);
}
};

View File

@@ -75,7 +75,7 @@ function ensureDatabaseInMongoURI(uri, dbName) {
url.pathname = `/${dbName}`;
return url.toString();
} catch (error) {
logger.error('Invalid URI format:', error.message);
logger.error('DBGM-00198 Invalid URI format:', error.message);
return uri;
}
}