Skip to content

Commit 6afb046

Browse files
Merge pull request #7
fix: logger
2 parents 8db8e53 + 9864a5c commit 6afb046

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

backend/src/config/winstonConfig.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
import winston from "winston";
2-
import chalk, { ChalkInstance} from "chalk";
3-
import LokiTransport from "winston-loki";
41
import { LogParams } from "../interfaces/logger";
52

3+
const winston = require("winston");
4+
const chalk = require("chalk");
5+
6+
7+
68

79
const { 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

Comments
 (0)