/logpost

Logging middleware in Hono.

Primary LanguageJavaScriptMIT LicenseMIT

LogPost

Logging middleware in Hono

Support Providers

  • console.log()
  • New Relic (docs)
  • Datadog (docs)

Usage

See example.js

  • Console (console.log())

    import { logpost } from './logpost.js'
    app.use('*', logpost())
  • New Relic

    import { logpost } from './logpost.js'
    app.use('*',
      logpost({
        type: 'newrelic',
        newrelic: {
          region: 'us',
          key: '<API Key (INGEST - LICENSE)>',
          // "req" is "c.raw.req"
          body: async (req) => {
            return {
              timestamp: Date.now(),
              path: req.url.pathname,
            }
          }
        }
      })
    )

Author

Shinosaki

LICENSE

MIT