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:
parent
65e7d05aad
commit
3cfddd1f58
|
@ -6,7 +6,7 @@
|
||||||
[subrepo]
|
[subrepo]
|
||||||
remote = git@github.com:benji7425/discord-bot-core.git
|
remote = git@github.com:benji7425/discord-bot-core.git
|
||||||
branch = master
|
branch = master
|
||||||
commit = 8efb033b8f7f421677f7ddb1aa3cc7801202bd54
|
commit = 5fd4a4323c96a7c75fef5cbe80c36ab02cf83c57
|
||||||
parent = ba6caa6be5cd775f794246736e1395ed7fa9f979
|
parent = 68f565c65c702462b84b0c2abc22711db92c3821
|
||||||
method = merge
|
method = merge
|
||||||
cmdver = 0.3.1
|
cmdver = 0.3.1
|
||||||
|
|
|
@ -56,7 +56,7 @@ module.exports = class Client extends Discord.Client {
|
||||||
|
|
||||||
onDebug(info) {
|
onDebug(info) {
|
||||||
if (!InternalConfig.debugIgnores.some(x => info.startsWith(x)))
|
if (!InternalConfig.debugIgnores.some(x => info.startsWith(x)))
|
||||||
CoreUtil.dateLog(info);
|
CoreUtil.dateDebug(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
onUnhandledException(client, err) {
|
onUnhandledException(client, err) {
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
const Console = require("console");
|
const Console = require("console");
|
||||||
const SimpleFileWriter = require("simple-file-writer");
|
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
|
* Returns a promise that the user will answer
|
||||||
|
@ -27,23 +28,40 @@ function ask(client, textChannel, member, question) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateLog(...args) {
|
function dateLog(...args) {
|
||||||
args = formatArgs(args);
|
doDateLog(Console.log, logWriter, args);
|
||||||
Console.log.apply(this, args);
|
|
||||||
logWriter.write(args.join("") + "\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function dateError(...args) {
|
function dateError(...args) {
|
||||||
|
doDateLog(Console.error, logWriter, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
function dateDebug(...args) {
|
||||||
|
doDateLog(null, null, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
function doDateLog(consoleMethod, fileWriter, args) {
|
||||||
args = formatArgs(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) {
|
function formatArgs(args) {
|
||||||
return ["[", new Date().toUTCString(), "] "].concat(args);
|
return ["[", new Date().toUTCString(), "] "].concat(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatArgsForFile(args) {
|
||||||
|
return args.join("") + "\n";
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
dateError,
|
dateError,
|
||||||
dateLog,
|
dateLog,
|
||||||
|
dateDebug,
|
||||||
ask
|
ask
|
||||||
};
|
};
|
Loading…
Reference in a new issue