Skip to content

Commit

Permalink
Emit logLine events for log lines that are built in events
Browse files Browse the repository at this point in the history
  • Loading branch information
niekcandaele committed May 3, 2020
1 parent b74ca0e commit 48fcf00
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/hooks/sdtdLogs/LoggingObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class LoggingObject extends EventEmitter {
);
this.queue.on("failed", (job, err) => this.handleFailedJob(job, err, this));
this.queue.on("error", this.handleError);
this.queue.on("cleaned", function(jobs, type) {
this.queue.on("cleaned", function (jobs, type) {
sails.log.debug("Cleaned %s %s jobs", jobs.length, type);
});
}
Expand Down Expand Up @@ -107,6 +107,8 @@ class LoggingObject extends EventEmitter {
let enrichedLog = newLog;
if (newLog.type !== "logLine") {
enrichedLog = await enrichData(newLog);
// We still want to emit these events as log lines aswell (for modules like hooks, discord notifications)
loggingObject.emit('logLine', enrichedLog.data);
}
if (this.debug) {
sails.log.debug(
Expand Down Expand Up @@ -179,7 +181,7 @@ class LoggingObject extends EventEmitter {
if (!this.slowmode) {
sails.log.info(
`SdtdLogs - Server ${
this.server.id
this.server.id
} has failed ${counter} times. Changing interval time. Server was last successful on ${prettyLastSuccess.toLocaleDateString()} ${prettyLastSuccess.toLocaleTimeString()}`
);
this.slowmode = true;
Expand Down

0 comments on commit 48fcf00

Please sign in to comment.