jaspervdj / websockets-snap

Snap integration for the websockets library
Other
33 stars 21 forks source link

Log integration #18

Open nomeata opened 8 years ago

nomeata commented 8 years ago

I’m using websockets-snap to integrate a websockets app into my snap server, and I am stuck finding out how to use snap’s logging facilities from the websockets code, and the websockets-snap documentation does not provide anything here. Is it possible to write to the error.log from the websockets handler?

jaspervdj-luminal commented 8 years ago

I don't think there is a way to do this. Snap provides: logError :: MonadSnap m => ByteString -> m (). What we would need, however, is something like getLogError :: MonadSnap m => m (ByteString -> IO ()). That way we could get the logger and pass it down. Do you think Snap could provide such a thing @mightybyte?

mightybyte commented 8 years ago

You definitely can't use Snap.Core.logError. However you can drop down to System.FastLogger which is provided by snap-server. I personally use an external logging library katip for my apps. YMMV.