Skip to main content

denzo-logger

Simple logger plugin for Denzo

Usage

Simple:

import { Denzo } from "denzo/mod.ts";
import { logger } from "../mod.ts";

const app = new Denzo();

app.register(logger, { allowRootHooks: true });

app.route({
  method: "GET",
  url: "/hi",
  handler() {
    return "Hello!";
  },
});

Options

Type

If you want to log requests timestamp, use type: "+timestamp" config option. (see examples)

Note: You won’t need this if you run your app in docker environment. link

Filter

If you want to filter some requests to not be logged, use filter: (request, reply) => ... config option. (see examples)

Disable coloring

This module supports NO_COLOR environmental variable, disables any coloring if NO_COLOR is set.
It’s recommended to disable coloring in production environment.