瀏覽代碼

Fix query time logging

Bond_009 6 年之前
父節點
當前提交
a9337033c1
共有 1 個文件被更改,包括 6 次插入5 次删除
  1. 6 5
      Emby.Server.Implementations/Data/SqliteItemRepository.cs

+ 6 - 5
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -2741,15 +2741,16 @@ namespace Emby.Server.Implementations.Data
         {
             var elapsed = (DateTime.UtcNow - startDate).TotalMilliseconds;
 
-            int slowThreshold = 100;
-
 #if DEBUG
-            slowThreshold = 10;
+            const int SlowThreshold = 100;
+#else
+            const int SlowThreshold = 10;
 #endif
 
-            if (elapsed >= slowThreshold)
+            if (elapsed >= SlowThreshold)
             {
-                Logger.LogWarning("{0} query time (slow): {1:g}. Query: {2}",
+                Logger.LogWarning(
+                    "{Method} query time (slow): {ElapsedMs}ms. Query: {Query}",
                     methodName,
                     elapsed,
                     commandText);