Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into staging
  • Loading branch information
slugb0t committed Dec 9, 2024
2 parents 82baf3f + c13e7a6 commit d4c2335
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bot/utils/logwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ class Logwatch {
consola.fatal(message);
this._sendLog("critical", message, isJson ? "json" : "text");
}

/** Explicit JSON logging */
json(level = "debug", message) {
consola[level](message);
this._sendLog(level, message, "json");
}
}

// Create and export a singleton instance
Expand All @@ -135,12 +141,13 @@ export { Logwatch };
// ~Text logging~
// logwatch.info("This is a text log");

// ~JSON logging~
// ~JSON logging~ (2 ways to do it)
// logwatch.debug({
// userId: 123,
// action: 'login',
// timestamp: new Date()
// }, true);
// logwatch.json('error', { message: 'Something went wrong' })

// ~Automatic string conversion~
// logwatch.warn({ key: 'value' }); // Will convert to string

0 comments on commit d4c2335

Please sign in to comment.