Skip to content

Presets

Nishant Aanjaney Jalan edited this page May 27, 2024 · 3 revisions

Presets are pre-configured setups created by the community. If you want a quick logging setup for your application, Logestic provides several presets to choose from. Currently, only 2 presets are installed by the author, but feel free to submit PRs to upload your preset to Logestic. Install a preset with this code:

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

const app = new Elysia()
  .use(Logestic.preset('[preset-name]')) // or .preset('[preset-name]', options)
  // ...
  .listen(process.env.PORT, () => {
    console.log("Server started");
  });

The setup to add logging into your application is as simple as above. By default, these presets come with their colour scheme and configuration so you don't need to write any extra code. You may override their default options by passing in an options object to the preset.

Here is a list of presets:

common
  .use(Logestic.preset('common'))
Common Preset
fancy
  .use(Logestic.preset('fancy'))
Fancy Preset
commontz
This preset is similar to common but the time logged is in the server's timezone.
  .use(Logestic.preset('commontz'))
Fancy Preset
Clone this wiki locally