Added simple code to handle /logs
refactored