[PATCH 3/5] logging: rework _output() function