Added logger

This commit is contained in:
Ionică Bizău 2015-02-01 15:28:22 +02:00
parent ae8f2b8db2
commit 64cb6f1b47

View file

@ -5,8 +5,12 @@ var GitStats = require("../lib")
, Fs = require("fs") , Fs = require("fs")
, AnsiParser = require("ansi-parser") , AnsiParser = require("ansi-parser")
, Couleurs = require("couleurs")() , Couleurs = require("couleurs")()
, Logger = require("bug-killer")
; ;
Logger.config.displayDate = false;
Logger.config.logLevel = 4;
const THEMES = { const THEMES = {
DARK: { DARK: {
background: "#11181F" background: "#11181F"
@ -42,18 +46,18 @@ switch (process.argv[2]) {
throw e; throw e;
} }
GitStats.record(data, function (err) { GitStats.record(data, function (err) {
if (err) { throw err; } if (err) { return Logger.log(err, "error"); }
}); });
break; break;
case "--help": case "--help":
console.log(Fs.readFileSync("./docs/help")); console.log(Fs.readFileSync("./docs/help", "utf-8"));
break; break;
case "-v": case "-v":
console.log(require("../package.json").version); console.log(require("../package.json").version);
break; break;
default: default:
GitStats.ansiCalendar(function (err, data) { GitStats.ansiCalendar(function (err, data) {
if (err) throw err; if (err) { return Logger.log(err, "error"); }
data = AnsiParser.removeAnsi(data); data = AnsiParser.removeAnsi(data);
if (process.argv.indexOf("--no-ansi") === -1) { if (process.argv.indexOf("--no-ansi") === -1) {
var theme = THEMES.DARK var theme = THEMES.DARK