Skip to content

Commit

Permalink
Change message levels
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-lippert committed Sep 20, 2023
1 parent dae397e commit 3893ae3
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,10 @@ export default {
fetch: async (req, env, ctx) => {
async function logMongo(data, isError = false) {
if (isError) {
console.log('彡', 'logs.errors.ctx.do', data)
console.error('彡', 'logs.errors.ctx.do', data)
} else {
console.error('彡', 'logs.logs.ctx.do', data)
console.log('彡', 'logs.logs.ctx.do', data)
}
if (env.MONGO_ENDPOINT)
return await fetch(env.MONGO_ENDPOINT + '/action/insertOne', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Access-Control-Request-Headers': '*',
'api-key': env.MONGO_APIKEY,
},
body: `{
"dataSource": "logs",
"database": "${isError ? 'errors' : 'logs'}",
"collection": "ctx.do",
"document": ${data}
}`
})
}

let body = ''
Expand Down

0 comments on commit 3893ae3

Please sign in to comment.