Skip to content

Commit

Permalink
Merge pull request #11 from Frezyx/dev
Browse files Browse the repository at this point in the history
Release v 0.7.0
  • Loading branch information
Frezyx authored Feb 11, 2022
2 parents 05b032b + f6735a2 commit 5acec38
Show file tree
Hide file tree
Showing 28 changed files with 298 additions and 237 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Follow these steps to use this package
### Add dependency
```yaml
dependencies:
talker: ^0.6.0
talker: ^0.7.0
```
### Easy to use
Expand Down Expand Up @@ -86,8 +86,8 @@ Often you need to check what happening in the application when there is no conso
### Add dependency
```yaml
dependencies:
talker: ^0.6.0
talker_flutter: ^0.5.0
talker: ^0.7.0
talker_flutter: ^0.5.3
```
### Easy to use
Expand All @@ -104,6 +104,8 @@ TalkerScreen(talker: Talker.instance)
- ErrorLevel as a model with customization
- Filter for logs in UI (talker_flutter)
- Flutter Talker customization / filters
- TalkerLogger settings using by Talker
- Remove additional field in TalkerDataInterface and all extended models
For help getting started with 😍 Flutter, view
[online documentation](https://flutter.dev/docs), which offers tutorials,
Expand Down
10 changes: 10 additions & 0 deletions talker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 0.7.0
- **BREAKING** Remove talker_error_handler package from talker deps
- **BREAKING** Rewrite error handler on talker package base
- **BREAKING** Update handle error / exceptions methods

## 0.6.1
- **BREAKING** Remove TalkerDataInterface,
TalkerLog, TalkerError, TalkerException field additional data


## 0.6.0
- Implement filter for logs

Expand Down
6 changes: 3 additions & 3 deletions talker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Follow these steps to use this package
### Add dependency
```yaml
dependencies:
talker: ^0.6.0
talker: ^0.7.0
```
### Easy to use
Expand Down Expand Up @@ -86,8 +86,8 @@ Often you need to check what happening in the application when there is no conso
### Add dependency
```yaml
dependencies:
talker: ^0.6.0
talker_flutter: ^0.5.0
talker: ^0.7.0
talker_flutter: ^0.5.3
```
### Easy to use
Expand Down
8 changes: 2 additions & 6 deletions talker/example/talker_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,18 @@ Future<void> main() async {
try {
throw Exception('Test service exception');
} catch (e, st) {
Talker.instance.handle(e, 'Working with string error', st);
Talker.instance.handle(e, st, 'Working with string error');
}

try {
throw Exception('Service can`t get test data');
} on Exception catch (e, st) {
Talker.instance.handleException(e, 'Working with strings exception', st);
Talker.instance.handleException(e, st, 'Working with strings exception');
}

Talker.instance.log(
'Server error',
logLevel: LogLevel.critical,
additional: {
"status": 500,
"error": "Internal Server Error",
},
);

Talker.instance.fine('Log fine');
Expand Down
1 change: 0 additions & 1 deletion talker/lib/src/extensions/extensions.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export 'log_level.dart';
export 'talker_data.dart';
20 changes: 0 additions & 20 deletions talker/lib/src/extensions/log_level.dart

This file was deleted.

13 changes: 0 additions & 13 deletions talker/lib/src/models/talker_data/talker_data_interface.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ abstract class TalkerDataInterface {
/// {@endtemplate}
StackTrace? get stackTrace;

/// {@template talker_data_additional}
/// [Map<String, dynamic>?] [additional] - additional log data for
/// {@endtemplate}
Map<String, dynamic>? get additional;

/// {@template talker_data_time}
/// Internal time when the error occurred
/// {@endtemplate}
Expand Down Expand Up @@ -106,14 +101,6 @@ extension FeildsToDisplay on TalkerDataInterface {
return '\n$error';
}

/// Displayed additional of [TalkerDataInterface]
String get displayAditional {
if (additional == null) {
return '';
}
return '\n$additional';
}

/// Displayed message of [TalkerDataInterface]
String get displayMessage {
if (message == null) {
Expand Down
21 changes: 16 additions & 5 deletions talker/lib/src/models/talker_data/talker_error.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,24 @@ class TalkerError implements TalkerDataInterface {
@override
DateTime get time => _time;

/// {@macro talker_data_additional}
/// Not used in [TalkerError]
@override
final Map<String, dynamic>? additional = null;

/// {@macro talker_data_exception}
/// Not used in [TalkerError]
@override
final Exception? exception = null;

TalkerError copyWith({
Error? error,
String? message,
StackTrace? stackTrace,
String? title,
LogLevel? logLevel,
}) {
return TalkerError(
error ?? this.error,
message: message ?? this.message,
stackTrace: stackTrace ?? this.stackTrace,
title: title ?? this.title,
logLevel: logLevel ?? this.logLevel,
);
}
}
5 changes: 0 additions & 5 deletions talker/lib/src/models/talker_data/talker_exception.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,4 @@ class TalkerException implements TalkerDataInterface {
/// Not used in [TalkerException]
@override
final Error? error = null;

/// {@macro talker_data_additional}
/// Not used in [TalkerException]
@override
final Map<String, dynamic>? additional = null;
}
7 changes: 1 addition & 6 deletions talker/lib/src/models/talker_data/talker_log.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ class TalkerLog implements TalkerDataInterface {
this.exception,
this.error,
this.stackTrace,
this.additional,
this.title,
DateTime? time,
this.pen,
Expand Down Expand Up @@ -38,18 +37,14 @@ class TalkerLog implements TalkerDataInterface {
@override
final String? title;

/// {@macro talker_data_additional}
@override
final Map<String, dynamic>? additional;

/// {@macro talker_data_loglevel}
@override
final LogLevel? logLevel;

/// {@macro talker_data_generateTextMessage}
@override
String generateTextMessage() {
return '$displayTitleWithTime$message$displayAditional';
return '$displayTitleWithTime$message';
}

/// {@macro talker_data_time}
Expand Down
20 changes: 13 additions & 7 deletions talker/lib/src/observers/observers_manager.dart
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
import 'package:talker/src/models/talker_data/talker_data.dart';
import 'package:talker/src/observers/talker_observer.dart';
import 'package:talker_error_handler/talker_error_handler.dart';

/// Manager to wrap all observers
class TalkerObserversManager {
TalkerObserversManager(this.observers);
final List<TalkerObserver> observers;

/// Called when [Talker] handle an error / exception
void onError(ErrorDetails container) {
/// Called when [Talker] handle an [TalkerError]
void onError(TalkerError talkerError) {
for (final o in observers) {
o.onError?.call(container);
o.onError?.call(talkerError);
}
}

/// Called when [Talker] handle an log
void onLog(TalkerDataInterface data) {
/// Called when [Talker] handle an [TalkerException]
void onException(TalkerException talkerException) {
for (final o in observers) {
o.onLog?.call(data);
o.onException?.call(talkerException);
}
}

/// Called when [Talker] handle an [TalkerDataInterface] log
void onLog(TalkerDataInterface log) {
for (final o in observers) {
o.onLog?.call(log);
}
}
}
13 changes: 8 additions & 5 deletions talker/lib/src/observers/talker_observer.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import 'package:talker/src/models/talker_data/talker_data.dart';
import 'package:talker_error_handler/talker_error_handler.dart';

/// Base observer class for
/// to create your own observers
class TalkerObserver {
const TalkerObserver({
this.onError,
this.onLog,
this.onException,
});

/// Called when [Talker] handle an error / exception
final Function(ErrorDetails err)? onError;
/// Called when [Talker] handle an [TalkerError]
final Function(TalkerError err)? onError;

/// Called when [Talker] handle an log
final Function(TalkerDataInterface data)? onLog;
/// Called when [Talker] handle an [TalkerException]
final Function(TalkerException err)? onException;

/// Called when [Talker] handle an [TalkerDataInterface] log
final Function(TalkerDataInterface log)? onLog;
}
Loading

0 comments on commit 5acec38

Please sign in to comment.