Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 990 Bytes

README.md

File metadata and controls

43 lines (30 loc) · 990 Bytes

Oak Log

Logging middleware for Oak framework

Setup

To configure the logger, first add the import for Oak-Log middleware:

import { Default as logger } from "https://deno.land/x/[email protected]/mod.ts";

now, add the logger to your application:

app.use(logger());

and Tada! You have logging working now.

Configuration

  • timeFormat: [string] - Time format for logs
  • format: [string] - Format for logs (Works only when fmt: text)
  • enableColors: [boolean] - Enable pretty colors for logs
  • output: [Deno.Writer] - An output sink for the logs
  • fmt: [json | text] - Format of the log

Default configuration looks something like:

export const defaultConfig: LoggerConfig = {
  enableColors: true,
  format: "${time} | ${status} |\t ${ip} |\t${method} | ${path}\n",
  timeFormat: "HH:mm:ss",
  output: Deno.stdout,
  fmt: "text",
};

License

MIT License