{"size": 853, "ext": "js", "max_stars_repo_path": "src/logging.js", "max_stars_repo_name": "cc-ebay/marko-starter", "max_stars_repo_stars_event_min_datetime": "2017-02-23T14:01:08.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-31T02:10:11.000Z", "max_issues_repo_path": "src/logging.js", "max_issues_repo_name": "cc-ebay/marko-starter", "max_issues_repo_issues_event_min_datetime": "2017-04-14T02:34:53.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-05T16:44:52.000Z", "max_forks_repo_path": "src/logging.js", "max_forks_repo_name": "cc-ebay/marko-starter", "max_forks_repo_forks_event_min_datetime": "2017-03-03T07:07:25.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-25T11:29:29.000Z"}
{"max_stars_count": 34, "max_issues_count": 47, "max_forks_count": 17, "avg_line_length": 18.5434782609, "max_line_length": 44, "alphanum_fraction": 0.5791324736}
'use strict';

class Logger {
  constructor (name, options) {
    let prefix = `[marko-starter ${name}] `;
    this.colors = options && options.colors;
    this.prefix = prefix;
  }

  debug (message) {
    let prefix = this.prefix;
    if (this.colors) {
      prefix = prefix.gray;
    }
    console.log(prefix + message);
  }

  success (message) {
    let prefix = this.prefix;
    if (this.colors) {
      prefix = prefix.green;
    }
    console.log(prefix + message);
  }

  info (message) {
    let prefix = this.prefix;
    if (this.colors) {
      prefix = prefix.cyan;
    }
    console.log(prefix + message);
  }

  error (message) {
    let prefix = this.prefix;
    if (this.colors) {
      prefix = prefix.red;
    }
    console.error(prefix + message);
  }
}

exports.logger = (name, options) => {
  return new Logger(name, options);
};
