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

@ -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}`);
}
/**