logging
This commit is contained in:
parent
c5300e4edf
commit
7438a77236
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,3 +2,4 @@ cfg/
|
|||
node_modules/
|
||||
dist/
|
||||
.vscode/
|
||||
logs/
|
150
package-lock.json
generated
150
package-lock.json
generated
|
@ -79,6 +79,11 @@
|
|||
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz",
|
||||
"integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ="
|
||||
},
|
||||
"async": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/async/-/async-1.0.0.tgz",
|
||||
"integrity": "sha1-+PwEyjoTeErenhZBr5hXjPvWR6k="
|
||||
},
|
||||
"async-each": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz",
|
||||
|
@ -968,6 +973,11 @@
|
|||
"resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
|
||||
"integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
|
||||
},
|
||||
"colors": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz",
|
||||
"integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs="
|
||||
},
|
||||
"combined-stream": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz",
|
||||
|
@ -1013,6 +1023,11 @@
|
|||
"boom": "2.10.1"
|
||||
}
|
||||
},
|
||||
"cycle": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/cycle/-/cycle-1.0.3.tgz",
|
||||
"integrity": "sha1-IegLK+hYD5i0aPN5QwZisEbDStI="
|
||||
},
|
||||
"dashdash": {
|
||||
"version": "1.14.1",
|
||||
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
|
||||
|
@ -1166,6 +1181,11 @@
|
|||
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz",
|
||||
"integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA="
|
||||
},
|
||||
"eyes": {
|
||||
"version": "0.1.8",
|
||||
"resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz",
|
||||
"integrity": "sha1-Ys8SAjTGg3hdkCNIqADvPgzCC8A="
|
||||
},
|
||||
"fast-deep-equal": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz",
|
||||
|
@ -1424,21 +1444,6 @@
|
|||
"loose-envify": "1.3.1"
|
||||
}
|
||||
},
|
||||
"irc-message": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/irc-message/-/irc-message-3.0.2.tgz",
|
||||
"integrity": "sha1-U3eyNcVMTjzlZTbJ1AxSkXmN+d8=",
|
||||
"requires": {
|
||||
"irc-prefix-parser": "1.0.1",
|
||||
"iso8601-convert": "1.0.0",
|
||||
"through2": "0.6.5"
|
||||
}
|
||||
},
|
||||
"irc-prefix-parser": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/irc-prefix-parser/-/irc-prefix-parser-1.0.1.tgz",
|
||||
"integrity": "sha1-Vs5g148w6bgLD88SP075+PLmLgs="
|
||||
},
|
||||
"is-binary-path": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz",
|
||||
|
@ -1560,11 +1565,6 @@
|
|||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
|
||||
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
|
||||
},
|
||||
"iso8601-convert": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/iso8601-convert/-/iso8601-convert-1.0.0.tgz",
|
||||
"integrity": "sha1-inCYB8mOYEZtnnlNgRJlyQpBVjU="
|
||||
},
|
||||
"isobject": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz",
|
||||
|
@ -1859,15 +1859,6 @@
|
|||
"is-glob": "2.0.1"
|
||||
}
|
||||
},
|
||||
"parse-irc": {
|
||||
"version": "0.2.4",
|
||||
"resolved": "https://registry.npmjs.org/parse-irc/-/parse-irc-0.2.4.tgz",
|
||||
"integrity": "sha1-BcVBeVmA2724Z9dGRhfF0FGaXvk=",
|
||||
"requires": {
|
||||
"inherits": "2.0.3",
|
||||
"through2-objectify": "0.1.1"
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
|
@ -2227,6 +2218,11 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"stack-trace": {
|
||||
"version": "0.0.10",
|
||||
"resolved": "https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.10.tgz",
|
||||
"integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA="
|
||||
},
|
||||
"stealthy-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
|
||||
|
@ -2268,84 +2264,6 @@
|
|||
"integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=",
|
||||
"dev": true
|
||||
},
|
||||
"through2": {
|
||||
"version": "0.6.5",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz",
|
||||
"integrity": "sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=",
|
||||
"requires": {
|
||||
"readable-stream": "1.0.34",
|
||||
"xtend": "4.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
"inherits": "2.0.3",
|
||||
"isarray": "0.0.1",
|
||||
"string_decoder": "0.10.31"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
}
|
||||
}
|
||||
},
|
||||
"through2-objectify": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/through2-objectify/-/through2-objectify-0.1.1.tgz",
|
||||
"integrity": "sha1-oHQaR4vLeRY3b5eSQRgaGwZEvBk=",
|
||||
"requires": {
|
||||
"inherits": "2.0.3",
|
||||
"through2": "0.5.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz",
|
||||
"integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8="
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.34",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||
"requires": {
|
||||
"core-util-is": "1.0.2",
|
||||
"inherits": "2.0.3",
|
||||
"isarray": "0.0.1",
|
||||
"string_decoder": "0.10.31"
|
||||
}
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz",
|
||||
"integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ="
|
||||
},
|
||||
"through2": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
|
||||
"integrity": "sha1-390BLrnHAOIyP9M084rGIqs3Lac=",
|
||||
"requires": {
|
||||
"readable-stream": "1.0.34",
|
||||
"xtend": "3.0.0"
|
||||
}
|
||||
},
|
||||
"xtend": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz",
|
||||
"integrity": "sha1-XM50B7r2Qsunvs2laBEcST9ZZlo="
|
||||
}
|
||||
}
|
||||
},
|
||||
"to-fast-properties": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz",
|
||||
|
@ -2418,16 +2336,24 @@
|
|||
"extsprintf": "1.0.2"
|
||||
}
|
||||
},
|
||||
"winston": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/winston/-/winston-2.4.0.tgz",
|
||||
"integrity": "sha1-gIBQuT1SZh7Z+2wms/DIJnCLCu4=",
|
||||
"requires": {
|
||||
"async": "1.0.0",
|
||||
"colors": "1.0.3",
|
||||
"cycle": "1.0.3",
|
||||
"eyes": "0.1.8",
|
||||
"isstream": "0.1.2",
|
||||
"stack-trace": "0.0.10"
|
||||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
},
|
||||
"xtend": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
|
||||
"integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
|
||||
},
|
||||
"youtube-dl": {
|
||||
"version": "1.12.2",
|
||||
"resolved": "https://registry.npmjs.org/youtube-dl/-/youtube-dl-1.12.2.tgz",
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"node-telegram-bot-api": "^0.29.0",
|
||||
"nodejs-mysql": "^0.1.3",
|
||||
"safe-eval": "^0.3.0",
|
||||
"winston": "^2.4.0",
|
||||
"youtube-dl": "^1.12.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { logger } from "./inc/log.js";
|
||||
import { read } from "./inc/cfg.js";
|
||||
import { wrapper, clients } from "./inc/wrapper.js";
|
||||
const safeEval = require("safe-eval");
|
||||
|
@ -54,7 +55,9 @@ read().then(() => {
|
|||
else if (e.message.match(/^\.butterkäse/)) {
|
||||
e.replyAction(`drischt mit einem großen Stück Butterkäse auf ${args[0]} ein.`);
|
||||
}
|
||||
logger.info(`${e.network} -> ${e.channel} -> ${e.user.nick}: ${e.message}`);
|
||||
});
|
||||
|
||||
bot.on("ctcp:version", e => {
|
||||
e.write(`notice ${e.user.nick} :\u0001VERSION Pimmel 2.1\u0001`);
|
||||
});
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { logger } from "../log.js";
|
||||
const net = require("net")
|
||||
, tls = require("tls")
|
||||
, EventEmitter = require("events").EventEmitter
|
||||
|
@ -43,14 +44,13 @@ class irc {
|
|||
this.cmd(this.parse(msg[tmp]));
|
||||
});
|
||||
}
|
||||
send() {
|
||||
for (let i = 0; i < arguments.length; i++)
|
||||
this.socket.write(arguments[i]);
|
||||
this.socket.write("\n");
|
||||
send(data) {
|
||||
this.socket.write(`${data}\n`);
|
||||
logger.debug(`out: ${data}`);
|
||||
}
|
||||
parse(data, [a, ...b] = data.split(/ +:/)) {
|
||||
console.log(a, b);
|
||||
let tmp = a.split(" ").concat(b);
|
||||
logger.debug(`in: ${[...tmp]}`);
|
||||
return data.charAt(0) === ":" ? {
|
||||
prefix: tmp.shift(),
|
||||
command: tmp.shift(),
|
||||
|
|
18
src/inc/log.js
Normal file
18
src/inc/log.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
const winston = require("winston");
|
||||
|
||||
const logger = new (winston.Logger)({
|
||||
transports: [
|
||||
new (winston.transports.File)({
|
||||
name: "debug-file",
|
||||
filename: `${__dirname}/../../logs/${~~(Date.now() / 1000)}_debug.log`,
|
||||
level: "debug"
|
||||
}),
|
||||
new (winston.transports.File)({
|
||||
name: "info-file",
|
||||
filename: `${__dirname}/../../logs/${~~(Date.now() / 1000)}.log`,
|
||||
level: "info"
|
||||
}),
|
||||
]
|
||||
});
|
||||
|
||||
export default { logger };
|
Loading…
Reference in New Issue
Block a user