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

App lifecycle logging & log persistence #286

Merged
merged 74 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 69 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
9b126da
first implementation of extended logger
KennyHuRadar Nov 20, 2023
86cab0a
new implementation
KennyHuRadar Nov 20, 2023
6708117
add to target
KennyHuRadar Nov 20, 2023
7e8e594
working prototype
KennyHuRadar Nov 21, 2023
047d0e6
moved file handler to property
KennyHuRadar Nov 21, 2023
0975548
implemented array of logs
KennyHuRadar Nov 21, 2023
f28ecb4
cleanup
KennyHuRadar Nov 21, 2023
1e24643
Merge branch 'master' into kennyhu/mob-64-ios-log-app-kills
KennyHuRadar Nov 21, 2023
6a2cb6c
make instance type nullable
KennyHuRadar Nov 21, 2023
b8a0c5d
change log type
KennyHuRadar Nov 22, 2023
96cf80f
changing naming
KennyHuRadar Nov 28, 2023
754d441
added optional timestamp and battery info
KennyHuRadar Nov 28, 2023
48cf311
revert changes to example
KennyHuRadar Nov 28, 2023
7db587a
remove comment
KennyHuRadar Nov 28, 2023
fa0ce67
remove log statement
KennyHuRadar Nov 28, 2023
6b71963
wip save, issue with log terminate?
KennyHuRadar Nov 29, 2023
cfb8002
added in unit tests
KennyHuRadar Nov 29, 2023
ace1d3b
wip but looks correct
KennyHuRadar Nov 30, 2023
d298726
cleanup
KennyHuRadar Nov 30, 2023
2f2f886
fixed bug and cleaned up
KennyHuRadar Dec 1, 2023
4e6febe
formatting
KennyHuRadar Dec 1, 2023
1187e87
renamed method
KennyHuRadar Dec 6, 2023
3be3e0c
commit changes in test file
KennyHuRadar Dec 6, 2023
7354d8f
rename persist func name
KennyHuRadar Dec 6, 2023
8fdafaf
change name to radarFileStorage
KennyHuRadar Dec 6, 2023
9601682
change name to radarFileStorage
KennyHuRadar Dec 6, 2023
2f8ad49
change name to radarFileStorage
KennyHuRadar Dec 6, 2023
324bf47
missed name change for radarFileStorage
KennyHuRadar Dec 6, 2023
2fa4205
change name
KennyHuRadar Dec 6, 2023
07df4e7
implemented individual file logging
KennyHuRadar Dec 7, 2023
b803820
fixed pruging
KennyHuRadar Dec 7, 2023
9696e9d
cleanup
KennyHuRadar Dec 7, 2023
1e5853c
rename clear
KennyHuRadar Dec 7, 2023
a88c7ca
rename enterbackground
KennyHuRadar Dec 7, 2023
4ad6751
update testing
KennyHuRadar Dec 7, 2023
05d81c2
remove write local log
KennyHuRadar Dec 7, 2023
6445fd0
foramtting
KennyHuRadar Dec 7, 2023
c62d1b5
remove dead code
KennyHuRadar Dec 7, 2023
f58291b
add nscoding back
KennyHuRadar Dec 7, 2023
9f4bff5
remove dead code
KennyHuRadar Dec 7, 2023
f67115e
spacing
KennyHuRadar Dec 7, 2023
8120e63
spacing
KennyHuRadar Dec 7, 2023
daaea6e
add array iteration safety
KennyHuRadar Dec 8, 2023
15c4eae
added feature flag
KennyHuRadar Dec 11, 2023
81e1404
fixed tests
KennyHuRadar Dec 11, 2023
40ecb97
changed way feature flag worked
KennyHuRadar Dec 11, 2023
7d09273
changed to default true
KennyHuRadar Dec 11, 2023
aa8f0c1
set deafult back to 0
KennyHuRadar Dec 11, 2023
81028e6
fix tests
KennyHuRadar Dec 11, 2023
c459603
condition on if in test env
KennyHuRadar Dec 11, 2023
3f95bc9
working on local
KennyHuRadar Dec 11, 2023
5b394c3
dynamically update feature flag to be read at runtime
KennyHuRadar Dec 12, 2023
58a26e1
cleanup
KennyHuRadar Dec 12, 2023
8c28a04
remove dead code
KennyHuRadar Dec 14, 2023
8900091
clean-up
KennyHuRadar Dec 14, 2023
c510409
cleanup
KennyHuRadar Dec 14, 2023
89fc7ac
remove period from logs
KennyHuRadar Dec 14, 2023
8f2a853
add back tab
KennyHuRadar Dec 14, 2023
0013a83
small fixes
KennyHuRadar Dec 15, 2023
e6134b5
Styling nits
lmeier Dec 18, 2023
f3c9c17
code review changes
KennyHuRadar Dec 19, 2023
53a94aa
fixed typo
KennyHuRadar Dec 20, 2023
3b978bd
remove append
KennyHuRadar Dec 20, 2023
205e8f3
change-name
KennyHuRadar Dec 20, 2023
6c9b15a
race condition fix
KennyHuRadar Jan 2, 2024
e1b0727
fix test
KennyHuRadar Jan 2, 2024
8eff93e
added a comment
KennyHuRadar Jan 2, 2024
cc58be3
Merge branch 'master' into presistent-logging
KennyHuRadar Jan 2, 2024
df3176e
version bump
KennyHuRadar Jan 2, 2024
a89cb66
refactor and fix format
KennyHuRadar Jan 3, 2024
7960e22
rename and format
KennyHuRadar Jan 3, 2024
fbc619f
update names
KennyHuRadar Jan 3, 2024
d6e4785
increase flush freq
KennyHuRadar Jan 3, 2024
677067f
remove the force persist writes from the lock
KennyHuRadar Jan 4, 2024
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
2 changes: 1 addition & 1 deletion RadarSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RadarSDK'
s.version = '3.8.12'
s.version = '3.8.13'
s.summary = 'iOS SDK for Radar, the leading geofencing and location tracking platform'
s.homepage = 'https://radar.com'
s.author = { 'Radar Labs, Inc.' => '[email protected]' }
Expand Down
16 changes: 12 additions & 4 deletions RadarSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@
DD8E2F7A24018C37002D51AB /* CLLocationManagerMock.m in Sources */ = {isa = PBXBuildFile; fileRef = DD8E2F7924018C37002D51AB /* CLLocationManagerMock.m */; };
DD8E2F7D24018C54002D51AB /* CLVisitMock.m in Sources */ = {isa = PBXBuildFile; fileRef = DD8E2F7C24018C54002D51AB /* CLVisitMock.m */; };
DE1E7644239724FD006F34A1 /* search_geofences.json in Resources */ = {isa = PBXBuildFile; fileRef = DE1E7643239724FD006F34A1 /* search_geofences.json */; };
E6EEC56E2B20F41A00DD096B /* RadarFileStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = E6EEC56D2B20F41A00DD096B /* RadarFileStorage.h */; };
E6EEC5702B20F45D00DD096B /* RadarFileStorage.m in Sources */ = {isa = PBXBuildFile; fileRef = E6EEC56F2B20F45D00DD096B /* RadarFileStorage.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -315,6 +317,8 @@
DDD7BD0325EC3015002473B3 /* RadarRouteMatrix.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RadarRouteMatrix.m; sourceTree = "<group>"; };
DDF1157C2524E18100D575C4 /* RadarTrip.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RadarTrip.m; sourceTree = "<group>"; };
DE1E7643239724FD006F34A1 /* search_geofences.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = search_geofences.json; sourceTree = "<group>"; };
E6EEC56D2B20F41A00DD096B /* RadarFileStorage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RadarFileStorage.h; sourceTree = "<group>"; };
E6EEC56F2B20F45D00DD096B /* RadarFileStorage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RadarFileStorage.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -447,6 +451,8 @@
58F950CF2407038300364B15 /* RadarCollectionAdditions.m */,
01F99CFA2965C182004E8CF3 /* RadarConfig.h */,
01F99CFC2965C1C4004E8CF3 /* RadarConfig.m */,
E6EEC56D2B20F41A00DD096B /* RadarFileStorage.h */,
E6EEC56F2B20F45D00DD096B /* RadarFileStorage.m */,
96A5A11727ADA02E007B960B /* RadarDelegateHolder.h */,
DD4C104925D87E3E009C2E36 /* RadarDelegateHolder.m */,
DD236CF723088F8400EB88F9 /* RadarLocationManager.h */,
Expand Down Expand Up @@ -604,6 +610,7 @@
96A5A10527AD9F7F007B960B /* RadarTrackingOptions.h in Headers */,
96A5A10927AD9F7F007B960B /* RadarContext.h in Headers */,
0107AA1226220049008AB52F /* RadarCollectionAdditions.h in Headers */,
E6EEC56E2B20F41A00DD096B /* RadarFileStorage.h in Headers */,
015C53AD29B8E8BA004F53A6 /* (null) in Headers */,
0107AA1C26220055008AB52F /* RadarPermissionsHelper.h in Headers */,
96A5A11227AD9F7F007B960B /* Radar.h in Headers */,
Expand Down Expand Up @@ -790,6 +797,7 @@
9679F4A327CD8DE200800797 /* CLLocation+Radar.m in Sources */,
0107AB08262201CE008AB52F /* RadarAPIClient.m in Sources */,
0107AB05262201CB008AB52F /* Radar.m in Sources */,
E6EEC5702B20F45D00DD096B /* RadarFileStorage.m in Sources */,
0107AB29262201F4008AB52F /* RadarTrackingOptions.m in Sources */,
0107AB2F262201FB008AB52F /* RadarUtils.m in Sources */,
0107AA8926220140008AB52F /* RadarChain.m in Sources */,
Expand Down Expand Up @@ -860,7 +868,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.8.12;
MARKETING_VERSION = 3.8.13;
PRODUCT_BUNDLE_IDENTIFIER = io.radar.sdk;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -890,7 +898,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.8.12;
MARKETING_VERSION = 3.8.13;
PRODUCT_BUNDLE_IDENTIFIER = io.radar.sdk;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down Expand Up @@ -973,7 +981,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MARKETING_VERSION = 3.8.12;
MARKETING_VERSION = 3.8.13;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -1031,7 +1039,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
MARKETING_VERSION = 3.8.12;
MARKETING_VERSION = 3.8.13;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_CFLAGS = "-fembed-bitcode";
Expand Down
18 changes: 18 additions & 0 deletions RadarSDK/Include/Radar.h
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,24 @@ logConversionWithNotification
*/
+ (void)setLogLevel:(RadarLogLevel)level;

/**
Log application terminating. Include this in your application delegate's applicationWillTerminate: method.

*/
+ (void)logTermination;

/**
Log application entering background. Include this in your application delegate's applicationDidEnterBackground: method.
*/
+ (void)logEnterBackground;

/**
Log application resigning active. Include this in your application delegate's applicationWillResignActive: method.

*/
+ (void)logResignActive;


#pragma mark - Helpers

/**
Expand Down
27 changes: 18 additions & 9 deletions RadarSDK/Radar.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ + (void)initializeWithPublishableKey:(NSString *)publishableKey {
completionHandler:^(RadarStatus status, RadarConfig *config) {
[[RadarLocationManager sharedInstance] updateTrackingFromMeta:config.meta];
[RadarSettings setFeatureSettings:config.meta.featureSettings];
[self flushLogs];
}];

}

#pragma mark - Properties
Expand Down Expand Up @@ -1036,6 +1038,20 @@ + (void)setLogLevel:(RadarLogLevel)level {
[RadarSettings setLogLevel:level];
}

+ (void)logTermination {
[[RadarLogger sharedInstance] logWithLevel:RadarLogLevelInfo type:RadarLogTypeNone message:@"App terminating" includeDate:YES includeBattery:YES append:YES];
}

+ (void)logEnterBackground {
[[RadarLogger sharedInstance] logWithLevel:RadarLogLevelInfo type:RadarLogTypeNone message:@"App entering background" includeDate:YES includeBattery:YES append:YES];
[[RadarLogBuffer sharedInstance] persistLogs];
}

+ (void)logResignActive {
[[RadarLogger sharedInstance] logWithLevel:RadarLogLevelInfo type:RadarLogTypeNone message:@"App resigning active" includeDate:YES includeBattery:YES];
}


#pragma mark - Helpers

+ (NSString *)stringForStatus:(RadarStatus)status {
Expand Down Expand Up @@ -1256,21 +1272,14 @@ + (void)flushLogs {
return;
}

NSArray<RadarLog *> *flushableLogs = [[RadarLogBuffer sharedInstance] flushableLogs];

NSArray<RadarLog *> *flushableLogs = [[RadarLogBuffer sharedInstance] flushableLogs];
NSUInteger pendingLogCount = [flushableLogs count];
if (pendingLogCount == 0) {
return;
}

// remove logs from buffer to handle multiple flushLogs calls
[[RadarLogBuffer sharedInstance] removeLogsFromBuffer:pendingLogCount];

RadarSyncLogsAPICompletionHandler onComplete = ^(RadarStatus status) {
// if an error occurs in syncing, add the logs back to the buffer
if (status != RadarStatusSuccess) {
[[RadarLogBuffer sharedInstance] addLogsToBuffer:flushableLogs];
}
[[RadarLogBuffer sharedInstance] onFlush:status == RadarStatusSuccess logs:flushableLogs];
};

[[RadarAPIClient sharedInstance] syncLogs:flushableLogs
Expand Down
4 changes: 3 additions & 1 deletion RadarSDK/RadarFeatureSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ NS_ASSUME_NONNULL_BEGIN
*/
@property (nonatomic, assign) BOOL usePersistence;
@property (nonatomic, assign) BOOL extendFlushReplays;
@property (nonatomic, assign) BOOL useLogPersistence;

/**
Initializes a new RadarFeatureSettings object with given value.

@param usePersistence A flag indicating whether to use persistence.
*/
- (instancetype)initWithUsePersistence:(BOOL)usePersistence
extendFlushReplays:(BOOL)extendFlushReplays;
extendFlushReplays:(BOOL)extendFlushReplays
useLogPersistence:(BOOL)useLogPersistence;

/**
Creates a RadarFeatureSettings object from the provided dictionary.
Expand Down
16 changes: 13 additions & 3 deletions RadarSDK/RadarFeatureSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@
@implementation RadarFeatureSettings

- (instancetype)initWithUsePersistence:(BOOL)usePersistence
extendFlushReplays:(BOOL)extendFlushReplays {
extendFlushReplays:(BOOL)extendFlushReplays
useLogPersistence:(BOOL)useLogPersistence {
if (self = [super init]) {
_usePersistence = usePersistence;
_extendFlushReplays = extendFlushReplays;
_useLogPersistence = useLogPersistence;
}
return self;
}

+ (RadarFeatureSettings *_Nullable)featureSettingsFromDictionary:(NSDictionary *)dict {
if (!dict) {
return [[RadarFeatureSettings alloc] initWithUsePersistence:NO extendFlushReplays:NO];
return [[RadarFeatureSettings alloc] initWithUsePersistence:NO extendFlushReplays:NO useLogPersistence:NO];
}

NSObject *usePersistenceObj = dict[@"usePersistence"];
Expand All @@ -34,13 +36,21 @@ + (RadarFeatureSettings *_Nullable)featureSettingsFromDictionary:(NSDictionary *
if (extendFlushReplaysObj && [extendFlushReplaysObj isKindOfClass:[NSNumber class]]) {
extendFlushReplays = [(NSNumber *)extendFlushReplaysObj boolValue];
}
return [[RadarFeatureSettings alloc] initWithUsePersistence:usePersistence extendFlushReplays:extendFlushReplays];

NSObject *useLogPersistenceObj = dict[@"useLogPersistence"];
BOOL useLogPersistence = NO;
if (useLogPersistenceObj && [useLogPersistenceObj isKindOfClass:[NSNumber class]]) {
useLogPersistence = [(NSNumber *)useLogPersistenceObj boolValue];
}

return [[RadarFeatureSettings alloc] initWithUsePersistence:usePersistence extendFlushReplays:extendFlushReplays useLogPersistence:useLogPersistence];
}

- (NSDictionary *)dictionaryValue {
NSMutableDictionary *dict = [NSMutableDictionary new];
[dict setValue:@(self.usePersistence) forKey:@"usePersistence"];
[dict setValue:@(self.extendFlushReplays) forKey:@"extendFlushReplays"];
[dict setValue:@(self.useLogPersistence) forKey:@"useLogPersistence"];

return dict;
}
Expand Down
24 changes: 24 additions & 0 deletions RadarSDK/RadarFileStorage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// RadarFileStorage.h
// RadarSDK
//
// Created by Kenny Hu on 12/6/23.
// Copyright © 2023 Radar Labs, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface RadarFileStorage : NSObject


- (NSData *)readFileAtPath:(NSString *)filePath;

- (void)writeData:(NSData *)data toFileAtPath:(NSString *)filePath;

- (void)deleteFileAtPath:(NSString *)filePath;

- (NSArray<NSString *> *)sortedFilesInDirectory:(NSString *)directoryPath;

- (NSArray<NSString *> *)sortedFilesInDirectory:(NSString *)directoryPath usingComparator:(NSComparator)comparator;

@end
61 changes: 61 additions & 0 deletions RadarSDK/RadarFileStorage.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
//
// RadarFileStorage.m
// RadarSDK
//
// Created by Kenny Hu on 12/6/23.
// Copyright © 2023 Radar Labs, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "RadarFileStorage.h"

@implementation RadarFileStorage



- (NSData *)readFileAtPath:(NSString *)filePath {
__block NSData *fileData = nil;

NSFileCoordinator *fileCoordinator = [[NSFileCoordinator alloc] init];
[fileCoordinator coordinateReadingItemAtURL:[NSURL fileURLWithPath:filePath] options:0 error:nil byAccessor:^(NSURL *newURL) {
fileData = [NSData dataWithContentsOfURL:newURL];
}];

return fileData;
}

- (void)writeData:(NSData *)data toFileAtPath:(NSString *)filePath {

NSFileCoordinator *fileCoordinator = [[NSFileCoordinator alloc] init];
[fileCoordinator coordinateWritingItemAtURL:[NSURL fileURLWithPath:filePath] options:NSFileCoordinatorWritingForReplacing error:nil byAccessor:^(NSURL *newURL) {
[data writeToURL:newURL options:NSDataWritingAtomic error:nil];
}];
}

- (void)deleteFileAtPath:(NSString *)filePath {
NSFileCoordinator *fileCoordinator = [[NSFileCoordinator alloc] init];
[fileCoordinator coordinateWritingItemAtURL:[NSURL fileURLWithPath:filePath] options:NSFileCoordinatorWritingForDeleting error:nil byAccessor:^(NSURL *newURL) {
[[NSFileManager defaultManager] removeItemAtURL:newURL error:nil];
}];
}

- (NSArray<NSString *> *)sortedFilesInDirectory:(NSString *)directoryPath {
return [self sortedFilesInDirectory:directoryPath usingComparator:^NSComparisonResult(NSString *fileName1, NSString *fileName2) {
return [fileName1 compare:fileName2];
}];
}

- (NSArray<NSString *> *)sortedFilesInDirectory:(NSString *)directoryPath usingComparator:(NSComparator)comparator {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSError *error = nil;
NSArray<NSString *> *files = [fileManager contentsOfDirectoryAtPath:directoryPath error:&error];

if (error) {
NSLog(@"Failed to get files in directory: %@", [error localizedDescription]);
return nil;
}

return [files sortedArrayUsingComparator: comparator];
}

@end
2 changes: 1 addition & 1 deletion RadarSDK/RadarLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
Represents a debug log.
*/
@interface RadarLog : NSObject
@interface RadarLog : NSObject <NSCoding>

/**
The levels for debug logs.
Expand Down
20 changes: 20 additions & 0 deletions RadarSDK/RadarLog.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,24 @@ - (NSDictionary *)dictionaryValue {
return arr;
}

#pragma mark - NSCoding

- (instancetype)initWithCoder:(NSCoder *)coder {
self = [super init];
if (self) {
_level = [coder decodeIntegerForKey:@"level"];
_type = [coder decodeIntegerForKey:@"type"];
_message = [coder decodeObjectForKey:@"message"];
_createdAt = [coder decodeObjectForKey:@"createdAt"];
}
return self;
}

- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeInteger:_level forKey:@"level"];
[coder encodeInteger:_type forKey:@"type"];
[coder encodeObject:_message forKey:@"message"];
[coder encodeObject:_createdAt forKey:@"createdAt"];
}

@end
15 changes: 12 additions & 3 deletions RadarSDK/RadarLogBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,31 @@
#import <Foundation/Foundation.h>

#import "RadarLog.h"
#import "RadarFileStorage.h"

NS_ASSUME_NONNULL_BEGIN

@interface RadarLogBuffer : NSObject

@property (assign, nonatomic, readonly) NSArray<RadarLog *> *flushableLogs;
@property (strong, nonatomic) NSString *logFileDir;
@property (strong, nonatomic) RadarFileStorage *fileHandler;
@property (nonatomic, strong) NSTimer *timer;
@property (nonatomic, assign) BOOL persistentLogFeatureFlag;

+ (instancetype)sharedInstance;

- (void)write:(RadarLogLevel)level type:(RadarLogType)type message:(NSString *)message;

- (void)purgeOldestLogs;
- (void)write:(RadarLogLevel)level type:(RadarLogType)type message:(NSString *)message forcePersist:(BOOL)forcePersist;

- (void)removeLogsFromBuffer:(NSUInteger)numLogs;
- (void)persistLogs;

- (void)addLogsToBuffer:(NSArray<RadarLog *> *)logs;
- (void)clearBuffer;

- (void)setPersistentLogFeatureFlag:(BOOL)persistentLogFeatureFlag;

- (void)onFlush:(BOOL)success logs:(NSArray<RadarLog *> *)logs;

@end

Expand Down
Loading
Loading