Skip to content

mehanalavimajd/cornel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub contributors GitHub forks GitHub issues GitHub GitHub code size in bytes


Cornel

A minimalist logging middleware Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Usage
  3. Roadmap
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

Morgan is one of the best logging middlewares for Express.js but, It's a little bit tough to work with it. It's also heavy (about 30kb). Cornel is a middleware which more focuses on being easy to use. It's also light (> 5kb)

(back to top)

Built With

(back to top)

Prerequisites

  • npm
    npm install npm@latest -g
  • Node js
  • Express.js
    npm i express

Installation

npm i cornel

(back to top)

Usage

Frist require express:

const express = require("express")
const app = express()

then require cornel:

const cornel = require("cornel")

Use it

app.use(cornel("Things to log")

You can put tokens in cornel parameter. Every time a request is made cornel will log the string you wrote there.

(back to top)

API

this list is about tokens you can use. :url:: same as req.url

:method:: same as req.method

:date:: same as Date().toString()

:date-iso:: same as Date().toISOString()

:date-utc: same as Date().toUTCString()

:http-version: : same as req.httpVersion

:refferer:: same as req.headers.referer

:remote-addr:: same as req.ip if it's empty it will use req.connection.remoteAddress

:status:: same as res.statusCode

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Project Link: https://github.com/mehanalavimajd/cornel Email: mehan.alavi.88.majd@gmail.com

(back to top)

About

An Express Middleware For logging data

Resources

License

Stars

Watchers

Forks

Packages

No packages published