Skip to content

Commit

Permalink
optimize log output
Browse files Browse the repository at this point in the history
  • Loading branch information
solaoi committed Jul 14, 2022
1 parent d74513c commit 3832bcc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/lib/sqlite3Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ const databasePath =
? join(process.cwd(), "db", database.replace("file:", ""))
: database.replace("file:", "")

const db = new Database(databasePath, { fileMustExist: true })
const db = new Database(databasePath, {
fileMustExist: true,
verbose: (o) => console.log("\u001b[32mbetter-sqlite3:query\x1b[39m " + o),
})

const getProjectIdByPreparedStatement = db.prepare("SELECT id FROM Project WHERE basePath = ?")
const getProjectIdBy = (basePath: string): number | null => {
Expand Down
3 changes: 3 additions & 0 deletions blitz.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { BlitzConfig, sessionMiddleware, simpleRolesIsAuthorized } from "blitz"

const config: BlitzConfig = {
log: {
level: "warn",
},
middleware: [
sessionMiddleware({
cookiePrefix: "co-metub",
Expand Down
2 changes: 1 addition & 1 deletion db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ import { PrismaClient } from "@prisma/client"
const EnhancedPrisma = enhancePrisma(PrismaClient)

export * from "@prisma/client"
export default new EnhancedPrisma()
export default new EnhancedPrisma({ log: ["query", "warn", "error"] })

0 comments on commit 3832bcc

Please sign in to comment.