Skip to content

Commit e6be163

Browse files
committed
fix(logs): use nuxt logger
1 parent 8fe3796 commit e6be163

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

layer/modules/assistant/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export interface AssistantModuleOptions {
2020
model?: string
2121
}
2222

23-
const log = logger.withTag('docus:assistant')
23+
const log = logger.withTag('Docus')
2424

2525
export default defineNuxtModule<AssistantModuleOptions>({
2626
meta: {

layer/modules/config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import { createResolver, defineNuxtModule } from '@nuxt/kit'
1+
import { createResolver, defineNuxtModule, logger } from '@nuxt/kit'
22
import { defu } from 'defu'
33
import { existsSync } from 'node:fs'
44
import { join } from 'node:path'
55
import { inferSiteURL, getPackageJsonMetadata } from '../utils/meta'
66
import { getGitBranch, getGitEnv, getLocalGitInfo } from '../utils/git'
77

8+
const log = logger.withTag('Docus')
9+
810
export default defineNuxtModule({
911
meta: {
1012
name: 'config',
@@ -68,11 +70,11 @@ export default defineNuxtModule({
6870
const hasContentFolder = existsSync(contentPath)
6971

7072
if (!hasLocaleFile) {
71-
console.warn(`[Docus] Locale file not found: ${localeCode}.json - skipping locale "${localeCode}"`)
73+
log.warn(`Locale file not found: ${localeCode}.json - skipping locale "${localeCode}"`)
7274
}
7375

7476
if (!hasContentFolder) {
75-
console.warn(`[Docus] Content folder not found: content/${localeCode}/ - skipping locale "${localeCode}"`)
77+
log.warn(`Content folder not found: content/${localeCode}/ - skipping locale "${localeCode}"`)
7678
}
7779

7880
return hasLocaleFile && hasContentFolder

layer/modules/markdown-rewrite.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import { defineNuxtModule } from '@nuxt/kit'
1+
import { defineNuxtModule, logger } from '@nuxt/kit'
22
import { resolve } from 'node:path'
33
import { readFile, writeFile } from 'node:fs/promises'
44

5+
const log = logger.withTag('Docus')
6+
57
export default defineNuxtModule({
68
meta: {
79
name: 'markdown-rewrite',
@@ -23,7 +25,7 @@ export default defineNuxtModule({
2325
llmsTxt = await readFile(llmsTxtPath, 'utf-8')
2426
}
2527
catch {
26-
console.warn('[Docus] llms.txt not found, skipping markdown redirect routes')
28+
log.warn('llms.txt not found, skipping markdown redirect routes')
2729
return
2830
}
2931

@@ -121,7 +123,7 @@ export default defineNuxtModule({
121123
vcConfig.routes.unshift(...routes)
122124

123125
await writeFile(vcJSON, JSON.stringify(vcConfig, null, 2), 'utf8')
124-
console.log(`[Docus] Successfully wrote ${routes.length} routes to ${vcJSON} (serve markdown content to AI agents)`)
126+
log.info(`Successfully wrote ${routes.length} routes to ${vcJSON} (serve markdown content to AI agents)`)
125127
})
126128
})
127129
},

0 commit comments

Comments
 (0)