From 15661510e66e875b86dcc6e1d92c9ba55affb95a Mon Sep 17 00:00:00 2001 From: Geoffrey McElhanon Date: Wed, 8 Jan 2025 21:53:09 -0600 Subject: [PATCH] Wrap diagnostic logging in debug conditional to avoid unnecessary string construction for unlogged messages in non-development environments (was notice while exploring options for using FeatureGate attribute from feature management library to disable controllers -- to no avail). --- .../Models/Graphs/BidirectionalGraphExtensions.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Application/EdFi.Ods.Common/Models/Graphs/BidirectionalGraphExtensions.cs b/Application/EdFi.Ods.Common/Models/Graphs/BidirectionalGraphExtensions.cs index 6cb0c1f6a2..74cd85da0b 100644 --- a/Application/EdFi.Ods.Common/Models/Graphs/BidirectionalGraphExtensions.cs +++ b/Application/EdFi.Ods.Common/Models/Graphs/BidirectionalGraphExtensions.cs @@ -28,7 +28,11 @@ public static IReadOnlyList> GetCycles( // Call the recursive helper function to detect cycle in different DFS trees foreach (var vertex in graph.Vertices) { - _logger.Debug($"Probing node '{vertex}' for cyclical dependencies..."); + if (_logger.IsDebugEnabled) + { + _logger.Debug($"Probing node '{vertex}' for cyclical dependencies..."); + } + graph.FindCycles(vertex, visited, stack, cycles); }