Finding server details programatically

I would like to be able to record the identity of the server hostname and port of the dash app at run time for logging and debugging purposes. Is this easy to find programatically? I know that the app.server should contain the host and port but I can’t introduce app into layouts or callback as this produces a circular reference.

Does anyone know how to obtain this information in a callback, for example?