There is only an admin action (which is used by the service console) to change a log level, you cannot do this programmatically. I think this is a nice feature request though, I've been wanting to do this a few times as well.
If you really need it right now, you could call that admin action yourself using a http client, if you first observe what the console actually sends to the server..