mirror of
https://github.com/thelounge/thelounge
synced 2024-11-23 20:43:08 +00:00
Merge pull request #670 from thelounge/astorije/hostmask-in-logs
Add hostmasks in logs when possible
This commit is contained in:
commit
da215d5465
1 changed files with 11 additions and 4 deletions
|
@ -16,19 +16,26 @@ module.exports.write = function(user, network, chan, msg) {
|
||||||
var tz = Helper.config.logs.timezone || "UTC+00:00";
|
var tz = Helper.config.logs.timezone || "UTC+00:00";
|
||||||
|
|
||||||
var time = moment().utcOffset(tz).format(format);
|
var time = moment().utcOffset(tz).format(format);
|
||||||
var line = "[" + time + "] ";
|
var line = `[${time}] `;
|
||||||
|
|
||||||
var type = msg.type.trim();
|
var type = msg.type.trim();
|
||||||
if (type === "message" || type === "highlight") {
|
if (type === "message" || type === "highlight") {
|
||||||
// Format:
|
// Format:
|
||||||
// [2014-01-01 00:00:00] <Arnold> Put that cookie down.. Now!!
|
// [2014-01-01 00:00:00] <Arnold> Put that cookie down.. Now!!
|
||||||
line += "<" + msg.from + "> " + msg.text;
|
line += `<${msg.from}> ${msg.text}`;
|
||||||
} else {
|
} else {
|
||||||
// Format:
|
// Format:
|
||||||
// [2014-01-01 00:00:00] * Arnold quit
|
// [2014-01-01 00:00:00] * Arnold quit
|
||||||
line += "* " + msg.from + " " + msg.type;
|
line += `* ${msg.from} `;
|
||||||
|
|
||||||
|
if (msg.hostmask) {
|
||||||
|
line += `(${msg.hostmask}) `;
|
||||||
|
}
|
||||||
|
|
||||||
|
line += msg.type;
|
||||||
|
|
||||||
if (msg.text) {
|
if (msg.text) {
|
||||||
line += " " + msg.text;
|
line += ` ${msg.text}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue