mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-20 16:49:52 +00:00
Improve Discord logging
This commit is contained in:
parent
f526e4ba39
commit
9ca10abdb4
1 changed files with 11 additions and 2 deletions
|
|
@ -7,8 +7,17 @@ class DiscordWinstonTransport extends Transport {
|
|||
}
|
||||
|
||||
async log(info, callback) {
|
||||
const { message } = info;
|
||||
await this._channel.send(`${message}`);
|
||||
const { message, ...rest } = info;
|
||||
let dataString = null;
|
||||
try {
|
||||
dataString = JSON.stringify(rest, null, 2);
|
||||
} catch (e) {
|
||||
dataString = "COULD NOT STRINGIFY DATA";
|
||||
}
|
||||
await this._channel.send(`${message}
|
||||
\`\`\`
|
||||
${dataString}
|
||||
\`\`\``);
|
||||
// Perform the writing to the remote service
|
||||
callback();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue