From 41a0749fcd14a1453144d8b525135fbffe6ff2aa Mon Sep 17 00:00:00 2001 From: Ben Allfree Date: Wed, 10 Jan 2024 16:37:27 +0000 Subject: [PATCH] logging update --- .../src/instances-notify-discord-after-create.pb.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/mothership-app/pb_hooks/src/instances-notify-discord-after-create.pb.js b/src/mothership-app/pb_hooks/src/instances-notify-discord-after-create.pb.js index 4ca556c3..f07ded5c 100644 --- a/src/mothership-app/pb_hooks/src/instances-notify-discord-after-create.pb.js +++ b/src/mothership-app/pb_hooks/src/instances-notify-discord-after-create.pb.js @@ -1,9 +1,12 @@ /// onModelAfterCreate((e) => { + const { audit, mkLog } = /** @type {Lib} */ (require(`${__hooks}/lib.js`)) + + const log = mkLog(`instances:create:discord:notify`) + const webhookUrl = $os.getenv('DISCORD_POCKETSTREAM_URL') if (!webhookUrl) { - console.warn(`***DISCORD_POCKETSTREAM_URL not defined`) return } const version = e.model.get('version') @@ -19,6 +22,6 @@ onModelAfterCreate((e) => { timeout: 5, // in seconds }) } catch (e) { - console.error(`***${e}`) + audit(`ERROR`, `Instance creation discord notify failed with ${e}`) } }, 'instances')