server: remove cli-highlight

This function is only used for highlighting logged PostgreSQL queries
which do not show up coloured in my log anyway so seems irrelevant.

Changelog: Changed
This commit is contained in:
Johann150 2024-10-10 11:23:00 +02:00
parent ebafed4a97
commit 67ebf83ed7
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1
2 changed files with 3 additions and 11 deletions

View file

@ -32,7 +32,6 @@
"bull": "4.8.4",
"cacheable-lookup": "6.0.4",
"cbor": "8.1.0",
"cli-highlight": "2.1.11",
"color-convert": "2.0.1",
"content-disposition": "0.5.4",
"date-fns": "2.28.0",

View file

@ -4,7 +4,6 @@ import pg from 'pg';
pg.types.setTypeParser(20, Number);
import { Logger, DataSource } from 'typeorm';
import * as highlight from 'cli-highlight';
import config from '@/config/index.js';
import { SECOND } from '@/const.js';
@ -74,22 +73,16 @@ import { dbLogger } from './logger.js';
const sqlLogger = dbLogger.createSubLogger('sql');
class MyCustomLogger implements Logger {
private highlight(sql: string): string {
return highlight.highlight(sql, {
language: 'sql', ignoreIllegals: true,
});
}
public logQuery(query: string): void {
sqlLogger.info(this.highlight(query).substring(0, 100));
sqlLogger.info(query);
}
public logQueryError(error: string, query: string): void {
sqlLogger.error(this.highlight(query));
sqlLogger.error(query);
}
public logQuerySlow(time: number, query: string): void {
sqlLogger.warn(this.highlight(query));
sqlLogger.warn(query);
}
public logSchemaBuild(message: string): void {