logger catagorizing libs
This commit is contained in:
parent
7a8e542ada
commit
4726a85cf3
12 changed files with 35 additions and 36 deletions
12
libs/cache/src/connection-manager.ts
vendored
12
libs/cache/src/connection-manager.ts
vendored
|
|
@ -48,7 +48,7 @@ export class RedisConnectionManager {
|
|||
const uniqueName = `${name}-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
||||
const connection = this.createConnection(uniqueName, redisConfig, db);
|
||||
this.connections.set(uniqueName, connection);
|
||||
this.logger.info(`Created unique Redis connection: ${uniqueName}`);
|
||||
this.logger.debug(`Created unique Redis connection: ${uniqueName}`);
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
|
|
@ -96,11 +96,11 @@ export class RedisConnectionManager {
|
|||
});
|
||||
|
||||
redis.on('close', () => {
|
||||
this.logger.info(`Redis connection closed: ${name}`);
|
||||
this.logger.warn(`Redis connection closed: ${name}`);
|
||||
});
|
||||
|
||||
redis.on('reconnecting', () => {
|
||||
this.logger.info(`Redis reconnecting: ${name}`);
|
||||
this.logger.warn(`Redis reconnecting: ${name}`);
|
||||
});
|
||||
|
||||
return redis;
|
||||
|
|
@ -113,7 +113,7 @@ export class RedisConnectionManager {
|
|||
try {
|
||||
await connection.quit();
|
||||
} catch (error) {
|
||||
this.logger.error('Error closing Redis connection:', error);
|
||||
this.logger.warn('Error closing Redis connection:', error);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,7 +202,7 @@ export class RedisConnectionManager {
|
|||
const allConnections = new Map([...instance.connections, ...this.sharedConnections]);
|
||||
|
||||
if (allConnections.size === 0) {
|
||||
instance.logger.info('No Redis connections to wait for');
|
||||
instance.logger.debug('No Redis connections to wait for');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +233,7 @@ export class RedisConnectionManager {
|
|||
const onReady = () => {
|
||||
clearTimeout(timeoutId);
|
||||
RedisConnectionManager.readyConnections.add(name);
|
||||
this.logger.info(`Redis connection ready: ${name}`);
|
||||
this.logger.debug(`Redis connection ready: ${name}`);
|
||||
resolve();
|
||||
};
|
||||
|
||||
|
|
|
|||
4
libs/cache/src/redis-cache.ts
vendored
4
libs/cache/src/redis-cache.ts
vendored
|
|
@ -79,7 +79,7 @@ export class RedisCache implements CacheProvider {
|
|||
});
|
||||
|
||||
this.redis.on('reconnecting', () => {
|
||||
this.logger.info('Redis cache reconnecting...');
|
||||
this.logger.warn('Redis cache reconnecting...');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -282,7 +282,7 @@ export class RedisCache implements CacheProvider {
|
|||
const keys = await this.redis.keys(pattern);
|
||||
if (keys.length > 0) {
|
||||
await this.redis.del(...keys);
|
||||
this.logger.info('Cache cleared', { keysDeleted: keys.length });
|
||||
this.logger.warn('Cache cleared', { keysDeleted: keys.length });
|
||||
}
|
||||
},
|
||||
undefined,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue