Skip to content

Commit 8277aa3

Browse files
committed
refactor: 🔨 replace debug calls with console calls inside the connect method of connectors
1 parent bf97d25 commit 8277aa3

3 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/component/connector/mongoose.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ module.exports = class MongooseStore {
8282
} catch(e) {
8383
attempts++;
8484

85-
debug(`Mongoose connection error: ${util.inspect(e)}`);
86-
debug(`Retrying connection to MongoDB (${attempts}/${maxAttempts}) attempts`);
85+
console.warn(`Mongoose connection error: ${util.inspect(e)}`);
86+
console.log(`Retrying connection to MongoDB (${attempts}/${maxAttempts}) attempts`);
8787

8888
if(attempts === maxAttempts) {
8989
if(exitOnConnectionFailure) {
90-
debug(`Failed to connect to MongoDB after ${maxAttempts} attempts. Exiting...`);
90+
console.error(`Failed to connect to MongoDB after ${maxAttempts} attempts. Exiting...`);
9191
process.exit(1);
9292
} else {
93-
debug(`Failed to connect to MongoDB after ${maxAttempts} attempts.`);
93+
console.warn(`Failed to connect to MongoDB after ${maxAttempts} attempts.`);
9494
}
9595
}
9696

src/component/connector/redis.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ module.exports = class RedisStore {
6767

6868
attempts++;
6969

70-
debug(`Redis connection error: ${util.inspect(e)}`);
71-
debug(`Retrying connection to Redis (${attempts}/${maxAttempts}) attempts`);
70+
console.warn(`Redis connection error: ${util.inspect(e)}`);
71+
console.log(`Retrying connection to Redis (${attempts}/${maxAttempts}) attempts`);
7272

7373
if(e.code === "ECONNREFUSED") {
7474
// Disconnect so that the next call to client.connect() will work.
@@ -79,10 +79,10 @@ module.exports = class RedisStore {
7979

8080
if((attempts === maxAttempts)) {
8181
if(exitOnConnectionFailure) {
82-
debug(`Failed to connect to Redis after ${maxAttempts} attempts. Exiting...`);
82+
console.error(`Failed to connect to Redis after ${maxAttempts} attempts. Exiting...`);
8383
process.exit(1);
8484
} else {
85-
debug(`Failed to connect to Redis after ${maxAttempts} attempts.`);
85+
console.warn(`Failed to connect to Redis after ${maxAttempts} attempts.`);
8686
}
8787
}
8888

src/component/connector/sequelize.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,15 @@ module.exports = class SequelizeStore {
120120
} catch(e) {
121121
attempts++;
122122

123-
this.#debug(`Sequelize connection error: ${util.inspect(e)}`);
124-
this.#debug(`Retrying connection to ${dbEngine} (${attempts}/${maxAttempts}) attempts`);
123+
console.warn(`Sequelize connection error: ${util.inspect(e)}`);
124+
console.log(`Retrying connection to ${dbEngine} (${attempts}/${maxAttempts}) attempts`);
125125

126126
if(attempts === maxAttempts) {
127127
if(exitOnConnectionFailure) {
128-
this.#debug(`Failed to connect to ${dbEngine} after ${maxAttempts} attempts. Exiting...`);
128+
console.error(`Failed to connect to ${dbEngine} after ${maxAttempts} attempts. Exiting...`);
129129
process.exit(1);
130130
} else {
131-
this.#debug(`Failed to connect to ${dbEngine} after ${maxAttempts} attempts.`);
131+
console.warn(`Failed to connect to ${dbEngine} after ${maxAttempts} attempts.`);
132132
}
133133
}
134134

0 commit comments

Comments
 (0)