I think this whole block's result should be cached on the instance so that it's executed only once. It seems fairly expensive so doing it for every log record is gonna be quite wasteful