I am wondering if it wouldn't be best to pass the ZMQContext here, plus a host/port string and a persistendId defaulting to monolog. That way the socket would only be created/connected on demand. I am not sure how expensive it is, but in general all monolog handlers try to do things lazily when possible since in production in many cases nothing gets logged.