This commit is contained in:
2025-07-04 00:02:18 +08:00
parent c7ddaf88f6
commit b3993f654c
4 changed files with 28 additions and 3 deletions

20
src/modules/logger.ts Normal file
View File

@@ -0,0 +1,20 @@
import { useConfig } from '@kevisual/use-config/env';
import { Logger } from '@kevisual/logger';
const config = useConfig();
export const logger = new Logger({
level: config.LOG_LEVEL || 'info',
showTime: true,
});
export const logError = (message: string, data?: any) => logger.error({ data }, message);
export const logWarning = (message: string, data?: any) => logger.warn({ data }, message);
export const logInfo = (message: string, data?: any) => logger.info({ data }, message);
export const logDebug = (message: string, data?: any) => logger.debug({ data }, message);
export const log = {
error: logError,
warn: logWarning,
info: logInfo,
debug: logDebug,
};