{"size": 955, "ext": "js", "max_stars_repo_path": "src/structures/client/Logger.js", "max_stars_repo_name": "linearaccelerator/our-awesome-bot", "max_stars_repo_stars_event_min_datetime": "2021-09-24T02:32:00.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-24T02:32:00.000Z", "max_issues_repo_path": "src/structures/client/Logger.js", "max_issues_repo_name": "linearaccelerator/our-awesome-bot", "max_issues_repo_issues_event_min_datetime": "2021-01-01T13:58:45.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-23T10:01:10.000Z", "max_forks_repo_path": "src/structures/client/Logger.js", "max_forks_repo_name": "linearaccelerator/our-awesome-bot", "max_forks_repo_forks_event_min_datetime": "2021-01-01T10:49:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-01T13:21:16.000Z"}
{"max_stars_count": 1, "max_issues_count": 5, "max_forks_count": 2, "avg_line_length": 17.6851851852, "max_line_length": 73, "alphanum_fraction": 0.5403141361}
const chalk = require('chalk').white;
const color = {
  log: chalk.white,
  debug: chalk.yellow,
  error: chalk.red,
  info: chalk.greenBright
};
const moment = require('moment');
class Logger {
  /**
   * @param {string} msg
   */
  log (msg) {
    this.write(msg);
  }

  /**
   * @param {string} msg
   */
  debug (msg) {
    this.write(msg, 'debug');
  }

  /**
   * @param {string} msg
   */
  info (msg) {
    this.write(msg, 'info');
  }

  /**
   * @param {string} msg
   */
  error (msg) {
    this.write(msg, 'error');
  }

  /**
   * @param {string} msg
   * @param {'log'|'info'|'error'|'debug'} type
   */
  write (msg, type = 'log') {
    const now = moment().format('h:mm:ss');
    process.stdout.write(color[type](`[${now}] | ${this.clean(msg)}\n`));
  }

  clean (msg) {
    if (typeof msg === 'string') return msg;
    const cleaned = require('util').inspect(msg, { depth: Infinity });
    return cleaned;
  }
}
module.exports = Logger;
