crummy
Crummy
A logger's bus. Also an adjective meaning "no good" or "undesirable"
crummy
is middleware to simply attach a bunyan logger to the request
context of your http server of choice. Below is a list of supported http server
modules:
If you don't see yours above, feel free to request it in the issues section of this repository, or use the adapter module to adapt it to your own.
The reason bunyan
is required is because it is the one popular logging module
that I could find that made it really easy to make a copy of a logger with all
of the different logging transports that the original had. If winston or other
loggers support this, I would be willing to support multiple logging modules.
express
Usage with const express = const crummy = const uuid = const log = const app = appapp // ... routes, other middleware, app.listen(), etc.
koa
Usage with const koa = const crummy = const uuid = const log = const app = appapp // ... other koa setup stuff
Usage on your own
This really isn't a lot of code. It just has some sensible defaults. The core piece of this module might make more sense if there were different adapters to utilize. Below is an example of what this module is doing without actually using this module:
const express = const uuid = const log = const app = app app // ... routes, other middleware, app.listen(), etc.
After reading that, you will probably just opt to just roll your own, which is totally fine. I wrote this because I don't like to have any miscellaneous modules lying around. I like most of my middleware stack to be declarative. For what it's worth, there are tests around the functionality described above, which might be a bit overkill.