c-cube / tiny_httpd

Minimal HTTP server using good old threads + blocking IO, with a small request router.
https://c-cube.github.io/tiny_httpd
75 stars 11 forks source link

add optional dependency on `logs` #77

Closed c-cube closed 7 months ago

c-cube commented 7 months ago

Logs is a de facto standard and it's too convenient to bypass

vphantom commented 7 months ago

What does "optional" mean in more practical terms here? (Unsurprisingly, I use another means of logging… 😛) You could somehow replace Tiny_httpd_log with Logs with some kind of compile-time strategy?

c-cube commented 7 months ago

Optional means that if you don't have logs installed you can still use tiny httpd :)

And I'd recommend using logs, it's a good library and for once people tend to converge on it!

vphantom commented 7 months ago

Okay good. 😃 And yes I did look into it, but in my case a dozen lines did the trick and it did something more tailored to what we need, though I can't remember what. STDIO stuff perhaps.

c-cube commented 7 months ago

I can give more details if you're interested, but Logs can easily emit on stdout/stderr, has optional locking, and you can do fun stuff (more advanced) with tags, eg associate a query ID with each log message in a way that can be picked up by the log reporter. It's quite flexible, and the continuation trick means you don't pay that much when a log message would be discarded (eg a debug message when debug isn't enabled).

c-cube commented 7 months ago

I can give more details if you're interested, but Logs can easily emit on stdout/stderr, has optional locking, and you can do fun stuff (more advanced) with tags, eg associate a query ID with each log message in a way that can be picked up by the log reporter. It's quite flexible, and the continuation trick means you don't pay that much when a log message would be discarded (eg a debug message when debug isn't enabled).