logging: false
This commit is contained in:
parent
834ae8623a
commit
1576d92efc
|
|
@ -24,6 +24,7 @@ export type HypeProps = {
|
||||||
reset?: boolean
|
reset?: boolean
|
||||||
prettyHTML?: boolean
|
prettyHTML?: boolean
|
||||||
layout?: boolean
|
layout?: boolean
|
||||||
|
logging?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
type InternalProps = HypeProps & { _isRouter?: boolean }
|
type InternalProps = HypeProps & { _isRouter?: boolean }
|
||||||
|
|
@ -89,6 +90,7 @@ export class Hype<
|
||||||
this.use('/css/*', serveStatic({ root: './src' }))
|
this.use('/css/*', serveStatic({ root: './src' }))
|
||||||
|
|
||||||
// console logging
|
// console logging
|
||||||
|
if (this.props.logging !== false) {
|
||||||
this.use('*', async (c, next) => {
|
this.use('*', async (c, next) => {
|
||||||
if (!SHOW_HTTP_LOG) return await next()
|
if (!SHOW_HTTP_LOG) return await next()
|
||||||
|
|
||||||
|
|
@ -99,6 +101,7 @@ export class Hype<
|
||||||
const method = c.req.method === 'GET' ? color.cyan(c.req.method) : color.magenta(c.req.method)
|
const method = c.req.method === 'GET' ? color.cyan(c.req.method) : color.magenta(c.req.method)
|
||||||
console.log(fn(`${c.res.status}`), `${color.bold(method)} ${c.req.url} (${end - start}ms)`)
|
console.log(fn(`${c.res.status}`), `${color.bold(method)} ${c.req.url} (${end - start}ms)`)
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// exception handler
|
// exception handler
|
||||||
this.onError((err, c) => {
|
this.onError((err, c) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user