Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tristanisham/logysia
Logysia is a logging library for the Elysia Web Framework for Bun (JS/TS).
https://github.com/tristanisham/logysia
Last synced: 13 days ago
JSON representation
Logysia is a logging library for the Elysia Web Framework for Bun (JS/TS).
- Host: GitHub
- URL: https://github.com/tristanisham/logysia
- Owner: tristanisham
- License: mit
- Created: 2023-09-08T02:29:11.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-09-07T11:44:43.000Z (2 months ago)
- Last Synced: 2024-10-19T05:16:38.681Z (25 days ago)
- Language: TypeScript
- Size: 29.3 KB
- Stars: 36
- Watchers: 4
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-elysia - Logysia - Classic logging middleware. (Plugins)
README
# Logysia
A logging middleware for the [Elysia](https://elysiajs.com) web framework. Developed with [Bun](https://bun.sh).## Installation
```sh
bun add @grotto/logysia
```
## Usage/Examples```typescript
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](https://i.ibb.co/5YknHt6/image.png)Logysia also supports printing when there are errors in your application.