Added advanced logging mechanism