git subrepo pull (merge) discord-bot-core

subrepo:
  subdir:   "discord-bot-core"
  merged:   "5fd4a43"
upstream:
  origin:   "git@github.com:benji7425/discord-bot-core.git"
  branch:   "master"
  commit:   "5fd4a43"
git-subrepo:
  version:  "0.3.1"
  origin:   "???"
  commit:   "???"
This commit is contained in:
benji7425 2017-11-11 01:13:18 +00:00
parent 65e7d05aad
commit 3cfddd1f58
3 changed files with 27 additions and 9 deletions

View file

@ -6,7 +6,7 @@
[subrepo]
remote = git@github.com:benji7425/discord-bot-core.git
branch = master
commit = 8efb033b8f7f421677f7ddb1aa3cc7801202bd54
parent = ba6caa6be5cd775f794246736e1395ed7fa9f979
commit = 5fd4a4323c96a7c75fef5cbe80c36ab02cf83c57
parent = 68f565c65c702462b84b0c2abc22711db92c3821
method = merge
cmdver = 0.3.1

View file

@ -56,7 +56,7 @@ module.exports = class Client extends Discord.Client {
onDebug(info) {
if (!InternalConfig.debugIgnores.some(x => info.startsWith(x)))
CoreUtil.dateLog(info);
CoreUtil.dateDebug(info);
}
onUnhandledException(client, err) {

View file

@ -1,7 +1,8 @@
const Console = require("console");
const SimpleFileWriter = require("simple-file-writer");
const logWriter = new SimpleFileWriter("./log");
const logWriter = new SimpleFileWriter("./console.log");
const debugLogWriter = new SimpleFileWriter("./debug.log");
/**
* Returns a promise that the user will answer
@ -27,23 +28,40 @@ function ask(client, textChannel, member, question) {
}
function dateLog(...args) {
args = formatArgs(args);
Console.log.apply(this, args);
logWriter.write(args.join("") + "\n");
doDateLog(Console.log, logWriter, args);
}
function dateError(...args) {
doDateLog(Console.error, logWriter, args);
}
function dateDebug(...args) {
doDateLog(null, null, args);
}
function doDateLog(consoleMethod, fileWriter, args) {
args = formatArgs(args);
Console.error.apply(this, args);
logWriter.write(args.join("") + "\n");
if (consoleMethod !== null)
consoleMethod.apply(this, args);
if (fileWriter !== null)
fileWriter.write(formatArgsForFile(args));
debugLogWriter.write(formatArgsForFile(args));
}
function formatArgs(args) {
return ["[", new Date().toUTCString(), "] "].concat(args);
}
function formatArgsForFile(args) {
return args.join("") + "\n";
}
module.exports = {
dateError,
dateLog,
dateDebug,
ask
};