19 lines
459 B
TypeScript
19 lines
459 B
TypeScript
import { prisma } from './db'
|
|
import { LogType } from '../../generated/prisma'
|
|
|
|
export async function createSystemLog(userId: string, type: LogType, message: string) {
|
|
try {
|
|
return await prisma.log.create({
|
|
data: {
|
|
userId,
|
|
type,
|
|
message,
|
|
},
|
|
})
|
|
} catch (error) {
|
|
console.error('[Logger Error]', error)
|
|
// Don't throw, we don't want logging errors to break the main application flow
|
|
return null
|
|
}
|
|
}
|