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