Actually check for memory exhaustion in logger

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>