Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR javascript console log redirect

SignalR logs lots of nice stuff to the console log when hubConnection.logging is turned on, but I would like it to go to a remote log instead. I can't see any way to redirect that output to my log besides replacing console.log which I really don't want to do.

Anyone know how?

like image 903
pinnprophead Avatar asked Jun 28 '26 23:06

pinnprophead


1 Answers

You can replace $.connection.fn.log which is called for all logging in the JS client:

$.connection.fn.log = function(msg) {
   // pipe somewhere else..
}

Note that this log method always gets called, i.e. if you want it to respect the $.connection.hub.logging setting, you have to check for that explicitly.

like image 71
Lars Höppner Avatar answered Jul 01 '26 11:07

Lars Höppner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!