Ejemplo n.º 1
0
 internal bool ShouldLog(ApiRequest request, ApiResponse response, long responseTimeInMs)
 {
     if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.None) == true)
         return false;
     else if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.Everything) == true)
         return true;
     else if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.Conditional) == true)
     {
         if (_condition != null && _condition(request, response) == true)
             return true;
     }
     else
     {
         if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.FailedCalls))
         {
             if (response == null) return true;
             if (response.Status == null) return true;
             if (response.Status.IsSuccessful == false) return true;
         }
         if (InternalApp.Debug.ApiLogging.MatchLogLevel(ApiLogFlags.SlowLogs) && responseTimeInMs > _slowLogThresholdInMilliSeconds)
             return true;
     }
     return false;
 }