Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

logestic

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logestic

An advanced and customisable logging library for ElysiaJS

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1K
increased by10.42%
Maintainers
1
Weekly downloads
 
Created
Source

Logestic

npm version

An advanced and customisable logging library for ElysiaJS.

Table of Contents

Installation

Add the package to your Elysia Project.

  bun add logestic

Note: You must have elysia@1.0 installed in your project.

Usage

There are two ways to add logging to your Elysia application.

Preset request logging

Currently, there are these presets available to use.

import { Elysia } from 'elysia';
import { Logestic } from 'logestic';

const app = new Elysia()
  .use(Logestic.preset('common'))
  .get('/', () => "Hello from server")
  .listen(5566);
Output:

Custom Preset

Custom request logging

If you don't like any of presets, you can configure Logestic to log your requests in your way.

  1. Create a Logestic instance, optionally where you wish to log.
  2. Call use to tell Logestic the information you wish to use.
  3. Finally, create an Elysia instance on custom with the formatting function.
// ./logger.ts
import { Logestic } from 'logestic';

// exports an Elysia instance
export default new Logestic(Bun.file('request.log'))
  .use(['method', 'path', 'time', 'status'])
  .format(({ method, path, time, status }) => {
    return `[${time}]: ${method} ${path} | ${status}`
  });


// ./index.ts
import myLogger from './logger';

const app = new Elysia()
  .use(myLogger)
  .get('/', () => "Hello from server")
  .listen(5566);

Consider contributing your own preset; check contributing guidelines.

Contributing Guidelines

See CONTRIBUTING.md

License

MIT

Authors

Keywords

FAQs

Package last updated on 21 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc