Skip to content

Commit

Permalink
wipp
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Nov 8, 2024
1 parent f136537 commit 0822fb5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ declare module 'werelogs' {
warn(msg: string, data?: LogDictionary): void;
error(msg: string, data?: LogDictionary): void;
fatal(msg: string, data?: LogDictionary): void;
end(msg?: string, data?: LogDictionary): void | EndLogger;
end(msg?: string, data?: LogDictionary): EndLogger;
end(msg: string, data?: LogDictionary): void;
errorEnd(msg: string, data?:LogDictionary): void;
}

Expand Down
14 changes: 10 additions & 4 deletions lib/RequestLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -356,15 +356,21 @@ class RequestLogger {
* for the log entry. This is how to provide
* metadata for a specific log entry.
*
* @returns {EndLogger|undefined}
* @returns {undefined}
*/
end(msg, data) {
if (msg === undefined && data === undefined) {
return this.endLogger;
}
return this.log(this.endLevel, msg, data, true);
}

/**
* Logging function to write the last log entry for the given RequestLogger
*
* @returns {EndLogger} The EndLogger instance to continue logging.
*/
end() {
return this.endLogger;
}

/**
* @deprecated since version 1.1
*
Expand Down

0 comments on commit 0822fb5

Please sign in to comment.