@tinyhttp/logger

npm (scoped) npm

Simple HTTP logger for tinyhttp.

Install

pnpm i @tinyhttp/logger

API

import { logger } from '@tinyhttp/logger'

logger(options)

Returns the middleware to log HTTP requests.

Options

Example

import { App } from '@tinyhttp/app'
import { logger } from '@tinyhttp/logger'

const app = new App()

app
  .use(logger({ methods: ['GET', 'POST'], timestamp: { format: 'HH:mm:ss' }, output: { callback: console.log, color: false } }))
  .get('/', (req, res) => void res.send('Hello world'))
  .post('/', (req, res) => void res.send('Sent POST'))
  .listen(3000)

Alternatives

License

MIT © v1rtl

Install

pnpm i @tinyhttp/logger

Version

0.3.33

Source

packages/logger