joncol / jcon-cpp

JSON RPC 2.0 library using C++ and Qt 6
MIT License
190 stars 65 forks source link

Logging/Middle-ware support? #49

Open trey-c opened 4 years ago

trey-c commented 4 years ago

Is their a safe/easy way to go about making logging/middle-ware routes?

P.S great library! We're about to use it in a production setting

joncol commented 4 years ago

Hey! Glad you like it! I'm not sure I understand what you mean by "logging/middle-ware routes"? Could you explain it further and give some example?

trey-c commented 4 years ago

Essentially I would like a more ideal way for logging routes. Because right now I'm just calling a logging function for every route I create, not a big deal but its a little tedious...

Perhaps something like this: jcon::JsonRpcServer* rpc_server; rpc_server = new jcon::JsonRpcWebSocketServer(parent); rpc_server->registerLogger([](...) { // this gets called before every route });` (Assuming something similar to this functionality doesn't already exist. lol)

And as for what I mean by middleware routes, something very similar to 'Node JS Express Middleware.' Not too sure how this could be implemented here. But it would be very neat.