Skip to content

Commit 3b456c7

Browse files
committed
Added back the feature flag after discussion
1 parent da9a987 commit 3b456c7

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Agent/FeatureFlags/NRMAFlags.m

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ + (NRMAFeatureFlags) featureFlags
4747
NRFeatureFlag_NetworkRequestEvents |
4848
NRFeatureFlag_RequestErrorEvents |
4949
NRFeatureFlag_DistributedTracing |
50-
NRFeatureFlag_AppStartMetrics;
50+
NRFeatureFlag_AppStartMetrics |
51+
NRFeatureFlag_AutoCollectLogs;
5152
});
5253
return __flags;
5354
}
@@ -177,6 +178,10 @@ + (BOOL) shouldEnableBackgroundReporting {
177178
return ([NRMAFlags featureFlags] & NRFeatureFlag_BackgroundReporting) != 0;
178179
}
179180

181+
+ (BOOL) shouldEnableAutoCollectLogs {
182+
return ([NRMAFlags featureFlags] & NRFeatureFlag_AutoCollectLogs) != 0;
183+
}
184+
180185
+ (NSArray<NSString*>*) namesForFlags:(NRMAFeatureFlags)flags {
181186
NSMutableArray *retArray = [NSMutableArray array];
182187
if ((flags & NRFeatureFlag_InteractionTracing) == NRFeatureFlag_InteractionTracing) {
@@ -239,6 +244,9 @@ + (BOOL) shouldEnableBackgroundReporting {
239244
if ((flags & NRFeatureFlag_BackgroundReporting) == NRFeatureFlag_BackgroundReporting) {
240245
[retArray addObject:@"BackgroundReporting"];
241246
}
247+
if ((flags & NRFeatureFlag_AutoCollectLogs) == NRFeatureFlag_AutoCollectLogs) {
248+
[retArray addObject:@"AutoCollectLogs"];
249+
}
242250

243251
return retArray;
244252
}

Agent/Harvester/NRMAHarvester.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ - (void) handleLoggingConfigurationUpdate {
774774
// This if/else chain should only be entered if log_reporting was found in the config
775775
if (configuration.has_log_reporting_config) {
776776
if (configuration.log_reporting_enabled) {
777-
if (![NewRelicInternalUtils isDebuggerAttached]){
777+
if ([NRMAFlags shouldEnableAutoCollectLogs] && ![NewRelicInternalUtils isDebuggerAttached]){
778778
[NRAutoLogCollector redirectStandardOutputAndError];
779779
// it is required to enable NRLogTargetFile when using LogReporting.
780780
[NRLogger setLogTargets:NRLogTargetFile];

Agent/Public/NewRelicFeatureFlags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,5 @@ typedef NS_OPTIONS(unsigned long long, NRMAFeatureFlags){
102102
NRFeatureFlag_NewEventSystem = 1 << 20, // Disabled by default
103103
NRFeatureFlag_OfflineStorage = 1 << 21, // Disabled by default
104104
NRFeatureFlag_BackgroundReporting = 1 << 22, // Disabled by default
105+
NRFeatureFlag_AutoCollectLogs = 1 << 23,
105106
};

0 commit comments

Comments
 (0)