CG-2786: Added $this to closure
CG-2786: Only log output and ignore empty buffers