Skip to content

Commit

Permalink
feat: set default value for key field
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrythomas committed Jan 18, 2024
1 parent eb5e203 commit 052add0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/logger/src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
* @param {string} key
* @returns {object}
*/
export function asObject(value, key) {
export function asObject(value, key = 'message') {
return value ? (typeof value === 'object' ? value : { [key]: value }) : {}
}

Expand All @@ -34,7 +34,7 @@ export async function log(writer, level, data) {
level,
running_on: runningOn,
logged_at: currentDate.toISOString(),
...asObject(data, 'message')
...asObject(data)
})
}

Expand Down

0 comments on commit 052add0

Please sign in to comment.