{"version":3,"sources":["../src/helpers/log.helper.ts"],"sourcesContent":["import winston from \"winston\";\nimport { LOG_COLORS, LOG_LEVELS } from \"../constants\";\n\n/**\n * A helper class for logging related operations.\n */\nexport abstract class LogHelper {\n  /**\n   * Retrieves the log level based on the current environment.\n   *\n   * @returns The log level as a string. In development mode, it returns \"debug\". In production mode, it returns \"warn\".\n   */\n  public static getLogLevel(environment: string = \"development\"): string {\n    const isDevelopment = environment === \"development\";\n    return isDevelopment ? \"debug\" : \"warn\";\n  }\n\n  /**\n   * Creates and configures a winston logger instance with the specified log level, format, and transports.\n   *\n   * @returns A configured winston Logger instance.\n   */\n  public static getLogger(environment?: string): winston.Logger {\n    const format = winston.format.combine(\n      winston.format.timestamp({ format: \"YYYY-MM-DD HH:mm:ss:ms\" }),\n      winston.format.colorize({ all: true }),\n      winston.format.printf(\n        (info) => `${info.timestamp} ${info.level}: ${info.message}`\n      )\n    );\n\n    const transports = [new winston.transports.Console()];\n\n    const Logger = winston.createLogger({\n      level: LogHelper.getLogLevel(environment),\n      levels: LOG_LEVELS,\n      format,\n      transports,\n    });\n    winston.addColors(LOG_COLORS);\n\n    return Logger;\n  }\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,OAAO,aAAa;AAApB,IAMsB;AANtB;AAAA;AAAA;AACA;AAKO,IAAe,YAAf,MAAe,WAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAM9B,OAAc,YAAY,cAAsB,eAAuB;AACrE,cAAM,gBAAgB,gBAAgB;AACtC,eAAO,gBAAgB,UAAU;AAAA,MACnC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOA,OAAc,UAAU,aAAsC;AAC5D,cAAM,SAAS,QAAQ,OAAO;AAAA,UAC5B,QAAQ,OAAO,UAAU,EAAE,QAAQ,yBAAyB,CAAC;AAAA,UAC7D,QAAQ,OAAO,SAAS,EAAE,KAAK,KAAK,CAAC;AAAA,UACrC,QAAQ,OAAO;AAAA,YACb,CAAC,SAAS,GAAG,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,KAAK,OAAO;AAAA,UAC5D;AAAA,QACF;AAEA,cAAM,aAAa,CAAC,IAAI,QAAQ,WAAW,QAAQ,CAAC;AAEpD,cAAM,SAAS,QAAQ,aAAa;AAAA,UAClC,OAAO,WAAU,YAAY,WAAW;AAAA,UACxC,QAAQ;AAAA,UACR;AAAA,UACA;AAAA,QACF,CAAC;AACD,gBAAQ,UAAU,UAAU;AAE5B,eAAO;AAAA,MACT;AAAA,IACF;AAAA;AAAA;","names":[]}