Upgrade to redwood 0.28.0

resolves #270
This commit is contained in:
Kurt Hutten
2021-03-27 05:11:35 +11:00
parent 9d7fdaa64a
commit f132ad2b87
7 changed files with 1338 additions and 1799 deletions

View File

@@ -3,4 +3,19 @@
import { PrismaClient } from '@prisma/client'
export const db = new PrismaClient()
import { emitLogLevels, handlePrismaLogging } from '@redwoodjs/api/logger'
import { logger } from './logger'
/*
* Instance of the Prisma Client
*/
export const db = new PrismaClient({
log: emitLogLevels(['info', 'warn', 'error']),
})
handlePrismaLogging({
db,
logger,
logLevels: ['info', 'warn', 'error'],
})

17
api/src/lib/logger.ts Normal file
View File

@@ -0,0 +1,17 @@
import { createLogger } from '@redwoodjs/api/logger'
/**
* Creates a logger with RedwoodLoggerOptions
*
* These extend and override default LoggerOptions,
* can define a destination like a file or other supported pin log transport stream,
* and sets where or not to show the logger configuration settings (defaults to false)
*
* @param RedwoodLoggerOptions
*
* RedwoodLoggerOptions have
* @param {options} LoggerOptions - defines how to log, such as pretty printing, redaction, and format
* @param {string | DestinationStream} destination - defines where to log, such as a transport stream or file
* @param {boolean} showConfig - whether to display logger configuration on initialization
*/
export const logger = createLogger({})