1- import winston from "winston" ;
2- import chalk , { ChalkInstance } from "chalk" ;
3- import LokiTransport from "winston-loki" ;
41import { LogParams } from "../interfaces/logger" ;
52
3+ const winston = require ( "winston" ) ;
4+ const chalk = require ( "chalk" ) ;
5+
6+
7+
68
79const { combine, timestamp, printf, errors } = winston . format ;
810
911// Define colors for log levels and messages
10- const levelColors : Record < string , ChalkInstance > = {
12+ const levelColors : Record < string , any > = {
1113 error : chalk . bold . red , // Bright red for errors
1214 warn : chalk . hex ( "#FFA500" ) , // Orange for warnings
1315 info : chalk . blue , // Blue for information
1416 debug : chalk . green , // Green for debugging
1517 default : chalk . white , // Default color for others
1618} ;
1719
18- const messageColors : Record < string , ChalkInstance > = {
20+ const messageColors : Record < string , any > = {
1921 error : chalk . redBright , // Highlight error messages
2022 warn : chalk . yellowBright , // Bright yellow for warnings
2123 info : chalk . cyan , // Cyan for information messages
@@ -24,7 +26,7 @@ const messageColors: Record<string, ChalkInstance> = {
2426} ;
2527
2628// Custom log format
27- const logFormat = printf ( ( { level, message, timestamp, stack, transaction_id , ...meta } ) => {
29+ const logFormat = printf ( ( { level, message, timestamp, stack, transaction_id , ...meta } : any ) => {
2830 const levelColor = levelColors [ level ] || levelColors . default ; // Colorize level
2931 const messageColor = messageColors [ level ] || messageColors . default ; // Colorize message
3032
0 commit comments