Skip to content

Commit

Permalink
Add mongo tail hook
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-lippert committed Sep 19, 2023
1 parent b179719 commit ada4673
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ let instanceRequests = 0
export default {
fetch: async (req, env, ctx) => {
async function logMongo(data, isError = false) {
if (isError) {
console.error('彡', 'logs.logs.ctx.do', data)
} else {
console.log('彡', 'logs.errors.ctx.do', data)
}
if (env.MONGO_ENDPOINT)
return await fetch(env.MONGO_ENDPOINT + '/action/insertOne', {
method: 'POST',
Expand Down

0 comments on commit ada4673

Please sign in to comment.