"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Logger = void 0;
var winston = require("winston");
var Config_1 = require("./Config");
var path = require('path');
var Logger = /** @class */ (function () {
    function Logger() {
    }
    Logger.configure = function () {
        var filename = path.join(Config_1.Config.logpath, "openflow.log");
        var options = {
            file: {
                level: "debug",
                filename: filename,
                handleExceptions: false,
                json: true,
                maxsize: 5242880,
                maxFiles: 5,
                colorize: false,
            },
            console: {
                level: "debug",
                handleExceptions: false,
                json: false,
                colorize: true
            },
        };
        var myFormat = winston.format.printf(function (info) {
            if (info instanceof Error || info.stack) {
                return info.timestamp + " [" + info.level + "] " + info.message + " \n " + info.stack;
            }
            return info.timestamp + " [" + info.level + "] " + info.message;
        });
        options.console.format = winston.format.combine(winston.format.errors({ stack: true }), winston.format.timestamp({ format: 'HH:mm:ss.sss' }), winston.format.colorize(), winston.format.json(), myFormat);
        var logger = winston.createLogger({
            level: "debug",
            //format: winston.format.json(),
            format: winston.format.combine(winston.format.errors({ stack: true }), winston.format.timestamp({ format: 'HH:mm:ss.sss' }), winston.format.json(), myFormat),
            transports: [
                new winston.transports.File(options.file),
                new winston.transports.Console(options.console)
            ]
        });
        Logger.instanse = logger;
        return logger;
    };
    Logger.instanse = null;
    return Logger;
}());
exports.Logger = Logger;
//# sourceMappingURL=Logger.js.map