Fixed namespace issues and made logging work with generic ostream