[middlewares] Add `timestamp` option to logger
See original GitHub issueWould be great if the logger could have an option to print out the timestamp via timestamp
property.
something like
app.use(logger({ timestamp: { format: 'MM:SS' } }))
and then
08:23:12 GET / 200 OK
I’m thinking of this option:
format: string
Probably could be consumed by some date library and then transformed into a timestamp
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Add a custom timestamp format option on Logger Middleware
I would like to set my own time configuration. it would be like: timestampFormat := "2006-01-02 15:04:05.00000" e.Use(middleware.
Read more >Adding timestamps to all console messages - node.js
It has a ton more logging options including logging to a json file or database. These always have timestamps by default. Just a...
Read more >A Guide To Writing Logging Middleware in Go
This is an opinionated guide on how to write extensible logging middleware for Go web services. I've had a number of requests to...
Read more >Logger - Fiber
Logger middleware for Fiber that logs HTTP request/response details. Table of Contents.
Read more >How we built a Node.js Middleware to Log HTTP API ... - Moesif
A guide on how we built our Node.js middleware that logs HTTP API Calls. ... Sometimes logging to stdout isn't an option and...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would like to take this issue if possible, would adding a dependency (something like
day.js
) for handling formatting of dates be acceptable?Shouldn’t time-stamping be a default behavior as-well?
output [unit of time]
is somewhat ambiguous. Are these options attempting to achieve time formatting? If so, would it not be better to pass something likeformat: 'HH:MM:SS'
, which can be parsed and output as such?