Skip to content

imsk17/oak-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A Logger Middleware For Oak Server.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •