"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var dayjs = require("dayjs");
var mslib_1 = require("mslib");
/**
 * 日志构建器
 * @date 2021-05-28 14:24:45
 * @author 吴锋霖
 */
var LoggerBuilder = /** @class */ (function () {
    function LoggerBuilder() {
        this.log = '';
    }
    /**
     * 添加日志
     * @param txt 文本内容
     */
    LoggerBuilder.prototype.append = function (txt, showTime) {
        if (showTime === void 0) { showTime = true; }
        if (showTime) {
            mslib_1.logger.info(txt);
        }
        this.log += (showTime ? this.makeTime() + txt : txt);
        return this;
    };
    /**
     * 添加日志并换行
     * @param txt 文本内容
     */
    LoggerBuilder.prototype.appendln = function (txt, showTime) {
        if (showTime === void 0) { showTime = true; }
        this.append(txt + '\n', showTime);
        return this;
    };
    LoggerBuilder.prototype.makeTime = function () {
        return "[" + dayjs().format('HH:mm:ss') + "] ";
    };
    LoggerBuilder.prototype.toString = function () {
        return this.log;
    };
    return LoggerBuilder;
}());
exports.LoggerBuilder = LoggerBuilder;
//# sourceMappingURL=LoggerBuilder.js.map