Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 Move to 'http' package by astashov · Pull Request #7 · Mixbook/rollbar.dart · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
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
2 changes: 1 addition & 1 deletion lib/rollbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ library rollbar;

import 'dart:async';
import 'dart:convert';
import 'dart:html';
import 'package:logging/logging.dart';
import 'package:stack_trace/stack_trace.dart';
import 'package:rollbar/src/map_util.dart';
import 'package:http/http.dart';

part 'src/rollbar_client.dart';
part 'src/rollbar_request.dart';
Expand Down
14 changes: 8 additions & 6 deletions lib/src/rollbar_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ class Rollbar {
String _accessToken;
Map<String, Object> _config;
Logger _logger;
Client _client;

Rollbar(this._accessToken, String environment, {Map<String, Object> config, Logger logger}) {
Rollbar(this._accessToken, String environment, {Map<String, Object> config, Logger logger, Client client}) {
_logger = logger != null ? logger : _defaultLogger;
_client = client != null ? client : new IOClient();

_config = config != null ? config : {};
_config.addAll({
Expand All @@ -18,7 +20,7 @@ class Rollbar {
});
}

Future<HttpRequest> trace(Object error, StackTrace stackTrace, {Map<String, Object> otherData}) {
Future<Response> trace(Object error, StackTrace stackTrace, {Map<String, Object> otherData}) {
var body = {
"trace": {
"frames": new Trace.from(stackTrace).frames.map((frame) {
Expand All @@ -37,10 +39,10 @@ class Rollbar {
};

var data = _generatePayloadData(body, otherData);
return new RollbarRequest(_accessToken, data, _logger).send();
return new RollbarRequest(_accessToken, data, _logger, _client).send();
}

Future<HttpRequest> message(String messageBody, {Map<String, Object> metadata, Map<String, Object> otherData}) {
Future<Response> message(String messageBody, {Map<String, Object> metadata, Map<String, Object> otherData}) {
var body = {
"message": {
"body": messageBody
Expand All @@ -52,7 +54,7 @@ class Rollbar {
}

var data = _generatePayloadData(body, otherData);
return new RollbarRequest(_accessToken, data, _logger).send();
return new RollbarRequest(_accessToken, data, _logger, _client).send();
}

/// Runs [body] in its own [Zone] and reports any uncaught asynchronous or synchronous
Expand All @@ -66,7 +68,7 @@ class Rollbar {
/// each error reported to Rollbar. The futures can be used to listen for completion
/// or errors while calling the Rollbar API. The stream will also contain any uncaught
/// errors originating from the zone. Use [Stream.handleError] to process these errors.
Stream<Future<HttpRequest>> traceErrorsInZone(body(), {Map<String, Object> otherData(error, StackTrace trace)}) {
Stream<Future<Response>> traceErrorsInZone(body(), {Map<String, Object> otherData(error, StackTrace trace)}) {
var errors = new StreamController.broadcast();

runZoned(body, onError: (error, stackTrace) {
Expand Down
18 changes: 9 additions & 9 deletions lib/src/rollbar_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@ class RollbarRequest {
String _accessToken;
Map<String, Object> _data;
Logger _logger;
Client _client;

RollbarRequest(this._accessToken, this._data, this._logger);
RollbarRequest(this._accessToken, this._data, this._logger, this._client);

Future<HttpRequest> send() {
Future<Response> send() {
var json = JSON.encode({"access_token": _accessToken, "data": _data});

var request = HttpRequest.request("https://api.rollbar.com/api/1/item/",
method: "POST",
requestHeaders: {"Content-Type": "application/json"},
sendData: json);
var request = _client.post("https://api.rollbar.com/api/1/item/",
headers: {"Content-Type": "application/json"},
body: json);

return request
..then((request) => _logStatus(request))
..then((response) => _logStatus(response))
..catchError((error) => _logError(error));
}

void _logStatus(HttpRequest request) {
switch(request.status) {
void _logStatus(Response response) {
switch(response.statusCode) {
case 200:
_logger.finer("Success. The item was accepted for processing.");
break;
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: rollbar
version: 0.2.0
version: 0.3.0
authors:
- Anton Astashov <anton.astashov@gmail.com>
- Dan Schultz <schultz.t.dan@gmail.com>
Expand All @@ -8,3 +8,4 @@ homepage: http://www.github.com/Mixbook/rollbar.dart
dependencies:
stack_trace: '>=1.0.2 <2.0.0'
logging: '>=0.9.1 <0.10.0'
http: '>=0.11.1'
0