Have a function that dumps all local variables to a given logger
Often when debugging ML it would be nice on a nan loss or something similar to be able to just get all local variables back before stopping the programm. I think this could be implemented with a simple function.