Skip to content

Commit d4f5792

Browse files
committed
feat: use wrapper consola
1 parent 3e96765 commit d4f5792

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
},
1616
"dependencies": {
1717
"@vueuse/nuxt": "^10.7.0",
18+
"consola": "^3.2.3",
1819
"yaml": "^2.3.4"
1920
},
2021
"devDependencies": {

Diff for: server/plugins/0.update-checker.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export default defineNitroPlugin(async () => {
1515
const difference = parseVersion(latestPackage.version) - parseVersion(currentPackage.version)
1616

1717
if (difference > 0) {
18-
return console.log(`⚠️ update available: ${latestPackage.version}`)
18+
return logger.warn(`update available: ${latestPackage.version}`)
1919
}
2020

21-
console.log('✅ mafl is up-to-date')
22-
} catch (_) {
23-
console.log('❌ failed to check for an update')
21+
logger.success('mafl is up-to-date')
22+
} catch (e) {
23+
logger.error('failed to check for an update', e)
2424
}
2525
})

Diff for: server/utils/logger.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { consola, createConsola } from 'consola'
2+
import type { ConsolaOptions } from 'consola'
3+
4+
export const logger = consola
5+
6+
export function useLogger(tag?: string, options: Partial<ConsolaOptions> = {}) {
7+
return tag ? createConsola({ ...options, fancy: true }).withTag(tag) : logger
8+
}

0 commit comments

Comments
 (0)