Added custom logging middleware