logger catagorizing libs

This commit is contained in:
Boki 2025-06-20 07:53:53 -04:00
parent 7a8e542ada
commit 4726a85cf3
12 changed files with 35 additions and 36 deletions

View file

@ -77,7 +77,7 @@ export class QuestDBClient {
return;
} catch (error) {
lastError = error as Error;
this.logger.error(`QuestDB connection attempt ${attempt} failed:`, error);
this.logger.warn(`QuestDB connection attempt ${attempt} failed:`, error);
if (this.pgPool) {
await this.pgPool.end();
@ -362,7 +362,7 @@ export class QuestDBClient {
*/
async optimizeTable(tableName: string): Promise<void> {
await this.query(`VACUUM TABLE ${tableName}`);
this.logger.info(`Optimized table: ${tableName}`);
this.logger.debug(`Optimized table: ${tableName}`);
}
/**

View file

@ -188,7 +188,7 @@ export class QuestDBHealthMonitor {
memoryUsage: process.memoryUsage().heapUsed,
};
this.logger.info('Performance metrics reset');
this.logger.debug('Performance metrics reset');
}
/**
@ -229,6 +229,6 @@ export class QuestDBHealthMonitor {
*/
public destroy(): void {
this.stopMonitoring();
this.logger.info('Health monitor destroyed');
this.logger.debug('Health monitor destroyed');
}
}

View file

@ -150,7 +150,7 @@ export class QuestDBInfluxWriter {
});
if (Object.keys(fields).length === 0) {
this.logger.warn('No analytics fields to write', { symbol, timestamp: analytics.timestamp });
this.logger.debug('No analytics fields to write', { symbol, timestamp: analytics.timestamp });
return;
}
@ -345,7 +345,7 @@ export class QuestDBInfluxWriter {
return;
} catch (error) {
attempt++;
this.logger.error(`Write attempt ${attempt} failed`, {
this.logger.warn(`Write attempt ${attempt} failed`, {
error,
linesCount: lines.length,
willRetry: attempt <= options.retryAttempts,
@ -425,6 +425,6 @@ export class QuestDBInfluxWriter {
*/
public destroy(): void {
this.clearBuffer();
this.logger.info('InfluxDB writer destroyed');
this.logger.debug('InfluxDB writer destroyed');
}
}

View file

@ -178,11 +178,11 @@ export class QuestDBSchemaManager {
try {
await this.client.query(sql);
this.logger.info(`Table ${schema.tableName} created`, { sql });
this.logger.debug(`Table ${schema.tableName} created`, { sql });
} catch (error) {
// Check if table already exists
if (error instanceof Error && error.message.includes('already exists')) {
this.logger.info(`Table ${schema.tableName} already exists`);
this.logger.debug(`Table ${schema.tableName} already exists`);
return;
}
throw error;
@ -197,7 +197,7 @@ export class QuestDBSchemaManager {
try {
await this.client.query(sql);
this.logger.info(`Table ${tableName} dropped`);
this.logger.warn(`Table ${tableName} dropped`);
} catch (error) {
this.logger.error(`Failed to drop table ${tableName}`, error);
throw error;
@ -234,7 +234,7 @@ export class QuestDBSchemaManager {
*/
public addSchema(schema: TableSchema): void {
this.schemas.set(schema.tableName, schema);
this.logger.info(`Schema added for table: ${schema.tableName}`);
this.logger.debug(`Schema added for table: ${schema.tableName}`);
}
/**
@ -256,7 +256,7 @@ export class QuestDBSchemaManager {
// QuestDB automatically optimizes, but we can analyze table stats
try {
const stats = await this.getTableStats(tableName);
this.logger.info(`Table ${tableName} stats`, stats);
this.logger.debug(`Table ${tableName} stats`, stats);
} catch (error) {
this.logger.error(`Failed to optimize table ${tableName}`, error);
throw error;
@ -289,7 +289,7 @@ export class QuestDBSchemaManager {
public async truncateTable(tableName: string): Promise<void> {
try {
await this.client.query(`TRUNCATE TABLE ${tableName}`);
this.logger.info(`Table ${tableName} truncated`);
this.logger.warn(`Table ${tableName} truncated`);
} catch (error) {
this.logger.error(`Failed to truncate table ${tableName}`, error);
throw error;
@ -302,7 +302,7 @@ export class QuestDBSchemaManager {
public async createPartitions(tableName: string, _days: number = 30): Promise<void> {
// QuestDB handles partitioning automatically based on the PARTITION BY clause
// This method is for future extensibility
this.logger.info(`Partitioning is automatic for table ${tableName}`);
this.logger.debug(`Partitioning is automatic for table ${tableName}`);
}
/**