Logfire Koa Client

Get started with Koa transport in 3 easy steps.

1. Install

Install Logfire Koa NPM package:

npm install @logfire-sh/koa

2. Set up Logfire client:

Set up Logfire client and attach it to Koa instance:

const Koa = require('koa')
const { Logfire } = require('@logfire-sh/koa')

// Create new Koa instanc
const koa = new Koa()

// Create new Logfire client
const logfire = new Logfire(`$SOURCE_TOKEN`)

// Attach Koa to enable HTTP request loggin
logfire.attach(koa);

Replace $SOURCE_TOKEN with your source token. You can get your source tokens in your Logfire sources.

3. Start logging 🎉


// Ensure that all logs are sent to Logfire
logfire.flush()

You should see your logs in Logfire → Live tail.


Koa version 2.6.2 or higher is required..