aboutsummaryrefslogtreecommitdiffstats
path: root/helpers/log.js
blob: 5e570c2387aa577c3f79af4fce3bd5f424492e29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
import Log from 'models/Log'

const log = async ({ email, action, callback, error }) => {
  try {
    await Log.create({ email, action, ...(error && {error: error?.message || '-'}) })
  } finally {
    if (callback) {
      return callback()
    }
  }
}

export default log