"use strict";
/**
 * Create a Console object
 *
 *  Copyright (C) 2010-2020 R-T Specialty, LLC.
 *
 *  This file is part of liza.
 *
 *  liza is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConsole = void 0;
var console_1 = require("console");
var fs = require("fs");
/**
 * Create a Console object
 *
 * @param log_location (optional) Used to determine how to build the Console
 * @return A Console object that can be used for logging
 */
exports.createConsole = function (log_location) {
    // when there is no log_location, use the standard `console`
    if (!log_location) {
        return console;
    }
    var stream = fs.createWriteStream(log_location, {
        flags: 'a',
    });
    return new console_1.Console(stream);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ29uc29sZUZhY3RvcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJDb25zb2xlRmFjdG9yeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7R0FtQkc7OztBQUVILG1DQUFnQztBQUNoQyx1QkFBeUI7QUFJekI7Ozs7O0dBS0c7QUFDVSxRQUFBLGFBQWEsR0FBRyxVQUFDLFlBQTBCO0lBQ3RELDREQUE0RDtJQUM1RCxJQUFJLENBQUMsWUFBWSxFQUFFO1FBQ2pCLE9BQU8sT0FBTyxDQUFDO0tBQ2hCO0lBRUQsSUFBTSxNQUFNLEdBQUcsRUFBRSxDQUFDLGlCQUFpQixDQUFDLFlBQVksRUFBRTtRQUNoRCxLQUFLLEVBQUUsR0FBRztLQUNYLENBQUMsQ0FBQztJQUVILE9BQU8sSUFBSSxpQkFBTyxDQUFDLE1BQU0sQ0FBQyxDQUFDO0FBQzdCLENBQUMsQ0FBQyJ9