moved logging into global handler