fix: replace consola with logger
This commit is contained in:
@ -1,5 +1,6 @@
|
|||||||
import type { ConnectOptions } from 'mongoose'
|
import type { ConnectOptions } from 'mongoose'
|
||||||
import { logger } from '@nuxt/kit'
|
import { consola } from 'consola'
|
||||||
|
import { colors } from 'consola/utils'
|
||||||
import mongoose from 'mongoose'
|
import mongoose from 'mongoose'
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -12,9 +13,9 @@ export async function defineMongooseConnection({ uri, options }: { uri?: string;
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await mongoose.connect(mongooseUri, { ...mongooseOptions })
|
await mongoose.connect(mongooseUri, { ...mongooseOptions })
|
||||||
logger.success('Connected to `MongoDB`')
|
consola.success('Connected to MongoDB')
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
logger.error('Error connecting to `MongoDB`', err)
|
consola.error(colors.red(`Error connecting to MongoDB: ${err}`))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user