cornel
v1.0.0
Published
An Express Middleware For logging data
Downloads
2
Readme
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)
Built With
Prerequisites
- npm
npm install npm@latest -g
- Node js
- Express.js
npm i express
Installation
npm i cornel
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.
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE.txt
for more information.
Contact
Project Link: https://github.com/mehanalavimajd/cornel Email: mehan.alavi.88.majd@gmail.com