Format stacktraces in logs 2

Seems #517 was a bit optimistic, as the stack frame info from ```get_stacktrace()``` can have argument lists instead of arities, and location information (file and line) can be omitted. These patches take that into account, and add tests.