Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default log level to NONE for live project #399

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions RadarSDK/Radar.m
Original file line number Diff line number Diff line change
Expand Up @@ -1351,23 +1351,11 @@ - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
}

+ (BOOL)canFlushLogs {
NSString *publishableKey = [RadarSettings publishableKey];
if ([publishableKey hasPrefix:@"prj_test_pk"] || [publishableKey hasPrefix:@"org_test_pk"] || [RadarSettings userDebug] || ([RadarSettings sdkConfiguration].logLevel && [RadarSettings sdkConfiguration].logLevel != RadarLogLevelNone)) {
return YES;
}
return NO;
}

+ (void)sendLog:(RadarLogLevel)level type:(RadarLogType)type message:(NSString *_Nonnull)message {
[[RadarLogBuffer sharedInstance] write:level type:type message:message ];
}

+ (void)flushLogs {
if (![self canFlushLogs]) {
return;
}

NSArray<RadarLog *> *flushableLogs = [[RadarLogBuffer sharedInstance] flushableLogs];
NSUInteger pendingLogCount = [flushableLogs count];
if (pendingLogCount == 0) {
Expand Down
4 changes: 2 additions & 2 deletions RadarSDK/RadarSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ + (void)setSdkConfiguration:(RadarSdkConfiguration *)sdkConfiguration {
[RadarUtils dictionaryToJson:[sdkConfiguration dictionaryValue]]]];
if (sdkConfiguration) {
[[RadarLogBuffer sharedInstance] setPersistentLogFeatureFlag:sdkConfiguration.useLogPersistence];
[[NSUserDefaults standardUserDefaults] setInteger:(int)sdkConfiguration.logLevel forKey:kLogLevel];
[RadarSettings setLogLevel:sdkConfiguration.logLevel];
[[NSUserDefaults standardUserDefaults] setObject:[sdkConfiguration dictionaryValue] forKey:kSdkConfiguration];
} else {
[[RadarLogBuffer sharedInstance] setPersistentLogFeatureFlag:NO];
Expand All @@ -263,7 +263,7 @@ + (RadarLogLevel)logLevel {
}

+ (void)setLogLevel:(RadarLogLevel)level {

[[NSUserDefaults standardUserDefaults] setInteger:(int)level forKey:kLogLevel];
}

+ (NSArray<NSString *> *_Nullable)beaconUUIDs {
Expand Down
Loading