{"size": 599, "ext": "js", "max_stars_repo_path": "handlers/logger.js", "max_stars_repo_name": "SailingJo/ahs-forum-hilfe-", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "handlers/logger.js", "max_issues_repo_name": "SailingJo/ahs-forum-hilfe-", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "handlers/logger.js", "max_forks_repo_name": "SailingJo/ahs-forum-hilfe-", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.9583333333, "max_line_length": 164, "alphanum_fraction": 0.6360601002}
const colors = require("colors");

const _chooseStatusCode = (statusCode) => {
  switch (statusCode.charAt(0)) {
    case "1":
      return colors.blue(statusCode);
    case "2":
      return colors.green(statusCode);
    case "3":
      return colors.yellow(statusCode);
    case "4":
    case "5":
      return colors.red(statusCode);
  }
}

const logHandshake = (req, res) => {
  console.log(`[ ${_chooseStatusCode(res.statusCode.toString())} ] [ ${colors.grey(new Date(Date.now()).toLocaleString("de"))} ] ${req.method} ${req.originalUrl}`);
}

module.exports = {
  logHandshake: logHandshake
}
