Improve log input handling