jcon-cpp icon indicating copy to clipboard operation
jcon-cpp copied to clipboard

Logging/Middle-ware support?

Open trey-c opened this issue 5 years ago • 2 comments

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

trey-c avatar Jun 09 '20 01:06 trey-c

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?

joncol avatar Jun 09 '20 06:06 joncol

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.

trey-c avatar Jun 17 '20 22:06 trey-c