const nextProcedure = t.procedure
.use(tracing({ collectInput: true, collectResult: true }))
.use(async ({ ctx, next }) => {
// Injecting context
const log = ctx.log
const start = Date.now()
const res = await next({ ctx: { ...ctx, log } })
const duration = Date.now() - start
if (res.ok) log.info({ duration, result: res.data })
else log.error({ duration, error: res.error })
return res
})
.experimental_caller(experimental_nextAppDirCaller({}))
const nextProcedure = t.procedure
.use(tracing({ collectInput: true, collectResult: true }))
.use(async ({ ctx, next }) => {
// Injecting context
const log = ctx.log
const start = Date.now()
const res = await next({ ctx: { ...ctx, log } })
const duration = Date.now() - start
if (res.ok) log.info({ duration, result: res.data })
else log.error({ duration, error: res.error })
return res
})
.experimental_caller(experimental_nextAppDirCaller({}))