@@ -69,21 +69,7 @@ public static bool IsEasyAuthEnabled(this IEnvironment environment)
69
69
/// <summary>
70
70
/// Returns true if any Functions AzureMonitor log categories are enabled.
71
71
/// </summary>
72
- public static bool IsAzureMonitorEnabled ( this IEnvironment environment )
73
- {
74
- string value = environment . GetEnvironmentVariable ( AzureMonitorCategories ) ;
75
- if ( value == null )
76
- {
77
- return true ;
78
- }
79
- string [ ] categories = value . Split ( ',' ) ;
80
- return categories . Contains ( ScriptConstants . AzureMonitorTraceCategory ) ;
81
- }
82
-
83
- /// <summary>
84
- /// Returns true if any Functions AzureMonitor log categories are enabled on legion based SKUs.
85
- /// </summary>
86
- public static bool IsAzureMonitorEnabledOnLegionSkus ( this IEnvironment environment )
72
+ public static bool IsAzureMonitorEnabled ( this IEnvironment environment , bool useCache = false )
87
73
{
88
74
string value = environment . GetEnvironmentVariable ( AzureMonitorCategories ) ;
89
75
if ( value == null )
@@ -96,13 +82,12 @@ public static bool IsAzureMonitorEnabledOnLegionSkus(this IEnvironment environme
96
82
// This is set when customer does not subscribe any category.
97
83
return false ;
98
84
}
99
- // If control came here, it means customer has subscribed to someazure monitor log categories.
100
- // So, cache whether FunctionsLogs category is subscribed.
101
- if ( isAzureMonitorLogsSubscribed == null )
85
+ if ( useCache && isAzureMonitorLogsSubscribed != null )
102
86
{
103
- string [ ] categories = value . Split ( ',' ) ;
104
- isAzureMonitorLogsSubscribed = categories . Contains ( ScriptConstants . AzureMonitorTraceCategory ) ;
87
+ return isAzureMonitorLogsSubscribed . Value ;
105
88
}
89
+ string [ ] categories = value . Split ( ',' ) ;
90
+ isAzureMonitorLogsSubscribed = categories . Contains ( ScriptConstants . AzureMonitorTraceCategory ) ;
106
91
return isAzureMonitorLogsSubscribed . Value ;
107
92
}
108
93
@@ -279,6 +264,16 @@ public static bool IsFlexConsumptionSku(this IEnvironment environment)
279
264
return ! environment . WebsiteSkuIsDynamic ( ) ;
280
265
}
281
266
267
+ /// <summary>
268
+ /// Gets a value indicating whether the application is running in Legion.
269
+ /// </summary>
270
+ /// <param name="environment">The environment to verify.</param>
271
+ /// <returns><see cref="true"/> if running on legion, false otherwise.</returns>
272
+ public static bool IsLegionBasedSku ( this IEnvironment environment )
273
+ {
274
+ return environment . IsFlexConsumptionSku ( ) || environment . IsLinuxConsumptionOnLegion ( ) ;
275
+ }
276
+
282
277
/// <summary>
283
278
/// Returns true if the app is running on Virtual Machine Scale Sets (VMSS).
284
279
/// </summary>
0 commit comments