-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d577e35
commit fabf56f
Showing
19 changed files
with
288 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import 'package:sentry/sentry.dart'; | ||
|
||
class DiagnosticLogger { | ||
final Logger _logger; | ||
final SentryOptions _options; | ||
|
||
DiagnosticLogger(this._logger, this._options); | ||
|
||
void log(SentryLevel level, String message) { | ||
if (_isEnabled(level)) { | ||
_logger(level, message); | ||
} | ||
} | ||
|
||
bool _isEnabled(SentryLevel level) { | ||
return _options.debug && level.ordinal >= _options.diagnosticLevel.ordinal; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'dart:async'; | ||
|
||
import 'client.dart'; | ||
import 'hub.dart'; | ||
import 'protocol/event.dart'; | ||
import 'protocol/sentry_level.dart'; | ||
import 'protocol/sentry_id.dart'; | ||
|
||
class NoOpHub implements Hub { | ||
NoOpHub._(); | ||
|
||
static final NoOpHub _instance = NoOpHub._(); | ||
|
||
factory NoOpHub() { | ||
return _instance; | ||
} | ||
|
||
@override | ||
void bindClient(SentryClient client) {} | ||
|
||
@override | ||
Future<SentryId> captureEvent(Event event) => Future.value(SentryId.empty()); | ||
|
||
@override | ||
Future<SentryId> captureException(throwable, {stackTrace}) => | ||
Future.value(SentryId.empty()); | ||
|
||
@override | ||
Future<SentryId> captureMessage( | ||
String message, { | ||
SentryLevel level = SentryLevel.info, | ||
String template, | ||
List params, | ||
}) => | ||
Future.value(SentryId.empty()); | ||
|
||
@override | ||
Hub clone() => this; | ||
|
||
@override | ||
void close() {} | ||
|
||
@override | ||
void configureScope(callback) {} | ||
|
||
@override | ||
bool get isEnabled => false; | ||
|
||
@override | ||
SentryId get lastEventId => SentryId.empty(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import 'package:meta/meta.dart'; | ||
|
||
/// Severity of the logged [Event]. | ||
@immutable | ||
class SentryLevel { | ||
const SentryLevel._(this.name, this.ordinal); | ||
|
||
static const fatal = SentryLevel._('fatal', 5); | ||
static const error = SentryLevel._('error', 4); | ||
static const warning = SentryLevel._('warning', 3); | ||
static const info = SentryLevel._('info', 2); | ||
static const debug = SentryLevel._('debug', 1); | ||
|
||
/// API name of the level as it is encoded in the JSON protocol. | ||
final String name; | ||
final int ordinal; | ||
} |
Oops, something went wrong.