Create logging middleware