node-ecstatic icon indicating copy to clipboard operation
node-ecstatic copied to clipboard

Add a logging option

Open dotnetCarpenter opened this issue 7 years ago • 7 comments

I don't know if I'm the only one who needs this, but because ecstatic is my main development server, I often wish I could see the requests in the console. I would like to be able to enable it with a simple CLI flag.

For log format I was thinking something like https://en.wikipedia.org/wiki/Common_Log_Format

dotnetCarpenter avatar Dec 16 '17 01:12 dotnetCarpenter

Yeah I could get behind a simple CLF-based logging format

jfhbrook avatar Dec 16 '17 06:12 jfhbrook

How about we integrate morgan? It offers a variety of log formats.

mk-pmb avatar Feb 13 '18 23:02 mk-pmb

@mk-pmb interesting. I'll take a look

dotnetCarpenter avatar Feb 14 '18 02:02 dotnetCarpenter

Example code for ecstatic stacked with logging.

mk-pmb avatar Feb 14 '18 13:02 mk-pmb

I think it's a reasonable stance to say that ecstatic's logging should be extremely lightweight and intended for stdout only. If this means pulling in a module this is OK, but should definitely not overengineer this. If a tiny custom class works just as well, we should consider that as well.

jfhbrook avatar Feb 14 '18 16:02 jfhbrook

Alternatively, we could consider implementing a very light-weight sub-middleware chaining mechanism inside the middleware function we return, so people can plug whatever logging and more. (Yo dawg, I heard you like middleware…)

mk-pmb avatar Feb 14 '18 16:02 mk-pmb

idk about sub-middlewares (I've been toying with the idea of moving away from express middleware support for well over a year now anyway), but a log property on the existing middleware to hook onto would make a lot of sense.

jfhbrook avatar Feb 14 '18 16:02 jfhbrook