Skip to content
This repository was archived by the owner on Jul 6, 2025. It is now read-only.

Commit 55c01d4

Browse files
author
Je
committed
refactor: improve log output
1 parent 0692e02 commit 55c01d4

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export class Logger {
6464
}
6565

6666
function colorfulTag(tag: string, colorful: (text: string) => string) {
67-
return [colors.dim('['), colorful(tag), colors.dim(']')].join(' ')
67+
return colorful(tag.toUpperCase())
6868
}
6969

7070
export default new Logger()

project.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ export class Project {
330330
const { ssr } = this.config
331331
const SPAIndexHtml = await this.getSPAIndexHtml()
332332
if (ssr) {
333-
log.info(colors.bold(' Pages (SSG)'))
333+
log.info(colors.bold('- Pages (SSG)'))
334334
const paths = new Set(this.#routing.paths)
335335
if (typeof ssr === 'object' && ssr.staticPaths) {
336336
ssr.staticPaths.forEach(path => paths.add(path))
@@ -345,11 +345,11 @@ export class Project {
345345
const dataFile = path.join(outputDir, '_aleph/data', pathname, 'data.js')
346346
await writeTextFile(dataFile, `export default ` + JSON.stringify(data))
347347
}
348-
log.info(' ○', pathname, colors.dim('• ' + util.bytesString(html.length)))
348+
log.info(' ○', pathname, colors.dim('• ' + util.bytesString(html.length)))
349349
} else if (status == 404) {
350-
log.info(' ○', colors.dim(pathname), colors.red(`Page not found`))
350+
log.info(' ○', colors.dim(pathname), colors.red(`Page not found`))
351351
} else if (status == 500) {
352-
log.info(' ○', colors.dim(pathname), colors.red(`Error 505`))
352+
log.info(' ○', colors.dim(pathname), colors.red(`Error 505`))
353353
}
354354
}
355355
}))
@@ -387,7 +387,7 @@ export class Project {
387387
const fi = await Deno.lstat(p)
388388
await ensureDir(path.dirname(fp))
389389
await Deno.copyFile(p, fp)
390-
log.info(' ✹', rp, colors.dim('•'), colorfulBytesString(fi.size))
390+
log.info(' ✹', rp, colors.dim('•'), colorfulBytesString(fi.size))
391391
}
392392
}
393393

@@ -424,10 +424,10 @@ export class Project {
424424
}))
425425

426426
const { deps, modules, styles } = moduleState
427-
log.info(colors.bold(' Modules'))
428-
log.info(' {}', colors.bold(deps.count.toString()), 'deps', colors.dim(`• ${util.bytesString(deps.bytes)} (mini, uncompress)`))
429-
log.info(' {}', colors.bold(modules.count.toString()), 'modules', colors.dim(`• ${util.bytesString(modules.bytes)} (mini, uncompress)`))
430-
log.info(' {}', colors.bold(styles.count.toString()), 'styles', colors.dim(`• ${util.bytesString(styles.bytes)} (mini, uncompress)`))
427+
log.info(colors.bold('- Modules'))
428+
log.info(' {}', colors.bold(deps.count.toString()), 'deps', colors.dim(`• ${util.bytesString(deps.bytes)} (mini, uncompress)`))
429+
log.info(' {}', colors.bold(modules.count.toString()), 'modules', colors.dim(`• ${util.bytesString(modules.bytes)} (mini, uncompress)`))
430+
log.info(' {}', colors.bold(styles.count.toString()), 'styles', colors.dim(`• ${util.bytesString(styles.bytes)} (mini, uncompress)`))
431431

432432
log.info(`Done in ${Math.round(performance.now() - start)}ms`)
433433
}
@@ -624,33 +624,33 @@ export class Project {
624624
const { renderPage, renderHead, renderScripts } = await import('file://' + this.#modules.get('//deno.land/x/aleph/renderer.js')!.jsFile)
625625
this.#renderer = { renderPage, renderHead, renderScripts }
626626

627-
log.info(colors.bold('Aleph.js'))
627+
log.info(colors.bold(`Aleph.js v${version}`))
628628
if (this.config.__file) {
629-
log.info(colors.bold(' Config'))
630-
log.info(' ⚙️', this.config.__file)
629+
log.info(colors.bold('- Config'))
630+
log.info(' ⚙️', this.config.__file)
631631
}
632-
log.info(colors.bold(' Global'))
632+
log.info(colors.bold('- Global'))
633633
if (this.#modules.has('/app.js')) {
634-
log.info(' ✓', 'Custom App')
634+
log.info(' ✓', 'Custom App')
635635
}
636636
if (this.#modules.has('/404.js')) {
637-
log.info(' ✓', 'Custom 404 Page')
637+
log.info(' ✓', 'Custom 404 Page')
638638
}
639639
if (this.#modules.has('/loading.js')) {
640-
log.info(' ✓', 'Custom Loading Page')
640+
log.info(' ✓', 'Custom Loading Page')
641641
}
642642

643643
if (this.isDev) {
644644
if (this.#apiRouting.paths.length > 0) {
645-
log.info(colors.bold(' APIs'))
645+
log.info(colors.bold('- APIs'))
646646
}
647647
for (const path of this.#apiRouting.paths) {
648-
log.info(' λ', path)
648+
log.info(' λ', path)
649649
}
650-
log.info(colors.bold(' Pages'))
650+
log.info(colors.bold('- Pages'))
651651
for (const path of this.#routing.paths) {
652652
const isIndex = path == '/'
653-
log.info(' ○', path, isIndex ? colors.dim('(index)') : '')
653+
log.info(' ○', path, isIndex ? colors.dim('(index)') : '')
654654
}
655655
}
656656

0 commit comments

Comments
 (0)