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

Enable sending complete JSON payloads, as proxy for other SDKs #155

Merged
merged 1 commit into from
Apr 19, 2019
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
4 changes: 4 additions & 0 deletions Rollbar/Rollbar.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@

+ (void)logCrashReport:(NSString*)crashReport;

// Send JSON payload

+ (void)sendJsonPayload:(NSData*)payload;

// Telemetry logging

+ (void)recordViewEventForLevel:(RollbarLevel)level element:(NSString *)element;
Expand Down
20 changes: 12 additions & 8 deletions Rollbar/Rollbar.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ + (void)enableCrashReporter {
}

+ (void)initWithAccessToken:(NSString *)accessToken {

[Rollbar initWithAccessToken:accessToken configuration:nil];
}

+ (void)initWithAccessToken:(NSString *)accessToken
configuration:(RollbarConfiguration*)configuration {

[Rollbar initWithAccessToken:accessToken configuration:configuration enableCrashReporter:YES];
}

+ (void)initWithAccessToken:(NSString *)accessToken
configuration:(RollbarConfiguration*)configuration
enableCrashReporter:(BOOL)enable {

[RollbarTelemetry sharedInstance]; // Load saved data, if any
if (notifier) {
RollbarLog(@"Rollbar has already been initialized.");
Expand All @@ -46,7 +46,7 @@ + (void)initWithAccessToken:(NSString *)accessToken
if (enable) {
[Rollbar enableCrashReporter];
}

[notifier.configuration save];
}
}
Expand All @@ -70,22 +70,22 @@ + (void)updateConfiguration:(RollbarConfiguration*)configuration

+ (void)log:(RollbarLevel)level
message:(NSString*)message {

[Rollbar log:level message:message exception:nil];
}

+ (void)log:(RollbarLevel)level
message:(NSString*)message
exception:(NSException*)exception {

[Rollbar log:level message:message exception:exception data:nil];
}

+ (void)log:(RollbarLevel)level
message:(NSString*)message
exception:(NSException*)exception
data:(NSDictionary*)data {

[Rollbar log:level message:message exception:exception data:data context:nil];
}

Expand All @@ -94,7 +94,7 @@ + (void)log:(RollbarLevel)level
exception:(NSException*)exception
data:(NSDictionary*)data
context:(NSString*)context {

[notifier log:RollbarStringFromLevel(level)
message:message
exception:exception
Expand Down Expand Up @@ -226,6 +226,10 @@ + (void)critical:(NSString*)message
[Rollbar log:RollbarCritical message:message exception:exception data:data context:context];
}

+ (void)sendJsonPayload:(NSData*)payload {
[notifier sendPayload:payload];
}

#pragma mark - Deprecated logging methods

// Log
Expand Down
14 changes: 12 additions & 2 deletions Rollbar/RollbarNotifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,29 @@

/**
Sends an item batch in a blocking manner.

@param payload an item to send
@param nextOffset the offset in the item queue file of the
item immediately after this batch. If the send is successful
or the retry limit is hit, nextOffset will be saved to the
queueState as the offset to use for the next batch

@return YES if this batch should be discarded if it was
successful or a retry limit was hit. Otherwise NO is returned if this
batch should be retried.
*/
- (BOOL)sendItem:(NSDictionary*)payload nextOffset:(NSUInteger)nextOffset;


/**
Sends a fully composed JSON payload.

@param payload complete Rollbar payload as JSON string

@return YES if successful. NO if not.
*/
- (BOOL)sendPayload:(NSData*)payload;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waltjones , I assume you are just stubbing it out since there is no implementation for this method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waltjones, i see. you essentially making it public here. missed that one...


// Update configuration methods
- (void)updateAccessToken:(NSString*)accessToken configuration:(RollbarConfiguration *)configuration isRoot:(BOOL)isRoot;
- (void)updateConfiguration:(RollbarConfiguration*)configuration isRoot:(BOOL)isRoot;
Expand Down