"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.setLogLevel = void 0;
const winston_1 = __importDefault(require("winston"));
const path_1 = __importDefault(require("path"));
const loglevel = "info";
/**
 *
 * @param {string} loglevel set log level as provided by config
 */
const setLogLevel = (loglevel) => {
    logger.level = loglevel;
};
exports.setLogLevel = setLogLevel;
/**
 * Global logger object with console and file transports
 * Uses formats, simple with timestamp format: YYYY-MM-DD HH:mm:ss, colorized
 * Logs to file camouflage.log at the root of project
 */
const logger = winston_1.default.createLogger({
    level: loglevel,
    format: winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.simple(), winston_1.default.format.timestamp({ format: "YYYY-MM-DD HH:mm:ss" }), winston_1.default.format.printf((log) => `${log.timestamp} ${log.level}: ${log.message}` + (log.splat !== undefined ? `${log.splat}` : " "))),
    transports: [
        new winston_1.default.transports.Console(),
        new winston_1.default.transports.File({
            filename: path_1.default.join(process.cwd(), "camouflage.log"),
        }),
    ],
});
exports.default = logger;
//# sourceMappingURL=index.js.map