@grotto/logysia
TypeScript icon, indicating that this package has built-in type declarations

0.1.3 • Public • Published

Logysia

A logging middleware for the Elysia web framework. Developed with Bun.

Installation

bun add @grotto/logysia

Usage/Examples

import { logger } from '@grotto/logysia';
import { Elysia } from "elysia";


if (import.meta.main) {
    const app = new Elysia()
        // These are the default options. You do not need to copy this down
        .use(logger({ 
            logIP: false,
            writer: {
                write(msg: string) {
                  console.log(msg)
                }
            }
        }))
        .get("/", ctx => "Hello, world!");
}

Configuration

Option Description
logIP Displays the incoming IP Address based on the XFF Header
writer Uses write function to send the log. Defaults to the console

Result

Alt text

Logysia also supports printing when there are errors in your application.

Package Sidebar

Install

npm i @grotto/logysia

Weekly Downloads

1,495

Version

0.1.3

License

ISC

Unpacked Size

6.93 kB

Total Files

4

Last publish

Collaborators

  • grotto