diff --git a/README.md b/README.md
index 57a46894..213eef4a 100644
--- a/README.md
+++ b/README.md
@@ -19,9 +19,10 @@
How it works?
-
-
-
+Here is the general scheme of the package and its main features
+
+
+
On All Platforms
@@ -37,7 +38,7 @@ Follow these steps to use this package
### Add dependency
```yaml
dependencies:
- talker: ^0.8.1
+ talker: ^0.9.0
```
### Easy to use
@@ -45,18 +46,18 @@ You can use Talker instance everywhere in your app
Simple and concise syntax will help you with this
```dart
-
+final talker = Talker();
// Handle exceptions and errors
try {
// your code...
} on Error catch (e, st) {
- Talker.instance.handleError(e, st, 'Error in ...');
+ talker.handleError(e, st, 'Error in ...');
}
// Log your app info
-Talker.instance.log('App is started'),
-Talker.instance.error('App is started'),
-Talker.instance.waring('App is started'),
+talker.log('App is started'),
+talker.error('App is started'),
+talker.waring('App is started'),
///...
```
More examples you can get [there](https://github.com/Frezyx/talker/blob/master/packages/talker/example/talker_example.dart) or in [docs](https://github.com/Frezyx/talker/blob/master/packages/talker/lib/src/talker_interface.dart)
@@ -64,8 +65,9 @@ More examples you can get [there](https://github.com/Frezyx/talker/blob/master/p
### Customization
Configure the error handler and logger for yourself
```dart
+final talker = Talker();
// Handle exceptions and errors
-Talker.instance.configure(
+talker.configure(
/// Your own observers to handle errors's exception's and log's
observers: [],
settings: const TalkerSettings(
@@ -86,26 +88,20 @@ Often you need to check what happening in the application when there is no conso
### Add dependency
```yaml
dependencies:
- talker: ^0.8.1
- talker_flutter: ^0.8.1
+ talker: ^0.9.0
+ talker_flutter: ^0.9.0
```
### Easy to use
Add this code at something place of your Flutter application where you want to display logs
```dart
-TalkerScreen(talker: Talker.instance)
+final talker = Talker();
+TalkerScreen(talker: talker)
```
### Result
-#### TODO:
-- LogLevel as a model with customization
-- 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,
diff --git a/docs/assets/scheme.gif b/docs/assets/scheme.gif
new file mode 100644
index 00000000..dcce408a
Binary files /dev/null and b/docs/assets/scheme.gif differ
diff --git a/packages/talker/CHANGELOG.md b/packages/talker/CHANGELOG.md
index 1170160d..50971335 100644
--- a/packages/talker/CHANGELOG.md
+++ b/packages/talker/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 0.9.0
+ - **BREAKING** Create common Talker constructor
+ - **BREAKING** After this version Talker is not singleton class
+ - **FEAT** Now you can create a lot of Talker instances for you app
+ - **FEAT** Now ***configure()*** method is not async
+
## 0.8.1
- **talker_logger** update to 0.8.0 version
- talker_logger changes:
diff --git a/packages/talker/README.md b/packages/talker/README.md
index 03d3076c..213eef4a 100644
--- a/packages/talker/README.md
+++ b/packages/talker/README.md
@@ -19,9 +19,10 @@
How it works?
-
-
-
+Here is the general scheme of the package and its main features
+
+
+
On All Platforms
@@ -37,7 +38,7 @@ Follow these steps to use this package
### Add dependency
```yaml
dependencies:
- talker: ^0.8.1
+ talker: ^0.9.0
```
### Easy to use
@@ -45,18 +46,18 @@ You can use Talker instance everywhere in your app
Simple and concise syntax will help you with this
```dart
-
+final talker = Talker();
// Handle exceptions and errors
try {
// your code...
} on Error catch (e, st) {
- Talker.instance.handleError(e, st, 'Error in ...');
+ talker.handleError(e, st, 'Error in ...');
}
// Log your app info
-Talker.instance.log('App is started'),
-Talker.instance.error('App is started'),
-Talker.instance.waring('App is started'),
+talker.log('App is started'),
+talker.error('App is started'),
+talker.waring('App is started'),
///...
```
More examples you can get [there](https://github.com/Frezyx/talker/blob/master/packages/talker/example/talker_example.dart) or in [docs](https://github.com/Frezyx/talker/blob/master/packages/talker/lib/src/talker_interface.dart)
@@ -64,11 +65,14 @@ More examples you can get [there](https://github.com/Frezyx/talker/blob/master/p
### Customization
Configure the error handler and logger for yourself
```dart
+final talker = Talker();
// Handle exceptions and errors
-Talker.instance.configure(
+talker.configure(
/// Your own observers to handle errors's exception's and log's
observers: [],
settings: const TalkerSettings(
+ /// Your own registered types of error's exception's and log's
+ registeredTypes: [HttpTalkerLog],
maxHistoryItems: 1000,
useHistory: true,
useConsoleLogs: true,
@@ -84,24 +88,20 @@ Often you need to check what happening in the application when there is no conso
### Add dependency
```yaml
dependencies:
- talker: ^0.8.1
- talker_flutter: ^0.8.1
+ talker: ^0.9.0
+ talker_flutter: ^0.9.0
```
### Easy to use
Add this code at something place of your Flutter application where you want to display logs
```dart
-TalkerScreen(talker: Talker.instance)
+final talker = Talker();
+TalkerScreen(talker: talker)
```
### Result
-#### TODO:
-- LogLevel as a model with customization
-- ErrorLevel as a model with customization
-- Filter for logs in UI (talker_flutter)
-- Flutter Talker customization / filters
For help getting started with ๐ Flutter, view
[online documentation](https://flutter.dev/docs), which offers tutorials,
diff --git a/packages/talker/example/talker_example.dart b/packages/talker/example/talker_example.dart
index d5ae763c..b3d7126f 100644
--- a/packages/talker/example/talker_example.dart
+++ b/packages/talker/example/talker_example.dart
@@ -13,7 +13,7 @@ class HttpTalkerLog extends TalkerLog {
}
Future main() async {
- await Talker.instance.configure(
+ final talker = Talker(
settings: TalkerSettings(
registeredTypes: [HttpTalkerLog],
),
@@ -22,27 +22,27 @@ Future main() async {
try {
throw Exception('Test service exception');
} catch (e, st) {
- Talker.instance.handle(e, st, 'Working with string error');
+ talker.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, st, 'Working with strings exception');
+ talker.handleException(e, st, 'Working with strings exception');
}
- Talker.instance.log(
+ talker.log(
'Server error',
logLevel: LogLevel.critical,
);
- Talker.instance.fine('Log fine');
- Talker.instance.error('Log error');
- Talker.instance.good('Log good');
- Talker.instance.verbose('Log verbose');
- Talker.instance.warning('Log warning');
- Talker.instance.critical('Log critical');
+ talker.fine('Log fine');
+ talker.error('Log error');
+ talker.good('Log good');
+ talker.verbose('Log verbose');
+ talker.warning('Log warning');
+ talker.critical('Log critical');
final httpLog = HttpTalkerLog('Http good');
- Talker.instance.logTyped(httpLog);
+ talker.logTyped(httpLog);
}
diff --git a/packages/talker/lib/src/settings/talker_settings.dart b/packages/talker/lib/src/settings/talker_settings.dart
index 740a0ada..a21969e8 100644
--- a/packages/talker/lib/src/settings/talker_settings.dart
+++ b/packages/talker/lib/src/settings/talker_settings.dart
@@ -50,14 +50,14 @@ class TalkerSettings {
///}
///
///void main() {
- /// Talker.instance.configure(
+ /// talker.configure(
/// settings: const TalkerSettings(
/// registeredTypes: [HttpTalkerLog],
/// ),
/// );
///
/// final httpLog = HttpTalkerLog('Http good');
- /// Talker.instance.logTyped(httpLog);
+ /// talker.logTyped(httpLog);
/// }
/// ```
List get registeredTypes =>
diff --git a/packages/talker/lib/src/talker.dart b/packages/talker/lib/src/talker.dart
index c8acf7fe..232cad3c 100644
--- a/packages/talker/lib/src/talker.dart
+++ b/packages/talker/lib/src/talker.dart
@@ -1,16 +1,52 @@
import 'dart:async';
import 'package:talker/talker.dart';
+/// Talker - advanced exception handling and logging
+/// for dart/flutter applications
class Talker implements TalkerInterface {
- Talker._() {
- _settings = TalkerSettings();
- _logger = TalkerLogger();
+ /// {@template talker_constructor}
+ /// Talker base constructor
+ ///
+ /// You can set your own [TalkerLogger] [logger] subclass
+ /// (create your own class implements [TalkerLoggerInterface]),
+ /// [TalkerLogger()] used by default
+ ///
+ /// You can edit package settings with [settings] [TalkerSettings],
+ /// [TalkerSettings()] used by default
+ ///
+ /// You can set your own [TalkerLoggerSettings] [loggerSettings]
+ /// to customize talker logs,
+ ///
+ /// You can set your own [TalkerLoggerFilter] [loggerFilter]
+ /// to filter talker logs,
+ ///
+ /// You can set your own [LoggerFormater] [loggerFormater]
+ /// to format output of talker logs,
+ ///
+ /// You can add your own observers to handle errors and logs in other place
+ /// [List] [observers],
+ /// {@endtemplate}
+ Talker({
+ TalkerLogger? logger,
+ TalkerSettings? settings,
+ TalkerLoggerSettings? loggerSettings,
+ TalkerLoggerFilter? loggerFilter,
+ LoggerFormater? loggerFormater,
+ List? observers,
+ }) {
+ _settings = settings ?? TalkerSettings();
+ _logger = logger ??
+ TalkerLogger().copyWith(
+ settings: loggerSettings,
+ filter: loggerFilter,
+ formater: loggerFormater,
+ );
+ if (observers != null && observers.isNotEmpty) {
+ _observersManager = TalkerObserversManager(observers);
+ }
_errorHandler = TalkerErrorHandler(_settings);
}
- static final _talker = Talker._();
- static TalkerInterface get instance => _talker;
-
/// Fields can be setup in [configure()] method
late TalkerSettings _settings;
late TalkerLoggerInterface _logger;
@@ -22,14 +58,14 @@ class Talker implements TalkerInterface {
/// {@macro talker_configure}
@override
- Future configure({
+ void configure({
TalkerLogger? logger,
TalkerSettings? settings,
TalkerLoggerSettings? loggerSettings,
TalkerLoggerFilter? loggerFilter,
LoggerFormater? loggerFormater,
List? observers,
- }) async {
+ }) {
if (settings != null) {
_settings = settings;
}
@@ -232,6 +268,18 @@ class Talker implements TalkerInterface {
}
}
+ ///{@macro talker_disable}
+ @override
+ void disable() {
+ _settings.enabled = false;
+ }
+
+ ///{@macro talker_enable}
+ @override
+ void enable() {
+ _settings.enabled = true;
+ }
+
void _handleLog(
String message,
Object? exception,
@@ -302,16 +350,4 @@ class Talker implements TalkerInterface {
_history.add(data);
}
}
-
- ///{@macro talker_disable}
- @override
- void disable() {
- _settings.enabled = false;
- }
-
- ///{@macro talker_enable}
- @override
- void enable() {
- _settings.enabled = true;
- }
}
diff --git a/packages/talker/lib/src/talker_interface.dart b/packages/talker/lib/src/talker_interface.dart
index f9107716..1f956b65 100644
--- a/packages/talker/lib/src/talker_interface.dart
+++ b/packages/talker/lib/src/talker_interface.dart
@@ -38,7 +38,7 @@ abstract class TalkerInterface {
/// You can add your own observers to handle errors and logs in other place
/// [List] [observers],
/// {@endtemplate}
- Future configure({
+ void configure({
TalkerSettings? settings,
TalkerLogger? logger,
TalkerLoggerSettings? loggerSettings,
@@ -57,7 +57,7 @@ abstract class TalkerInterface {
/// try {
/// // your code...
/// } catch (e, st) {
- /// Talker.instance.handle(e, 'Eception in ...', st);
+ /// talker.handle(e, 'Eception in ...', st);
/// }
/// ```
///
@@ -79,7 +79,7 @@ abstract class TalkerInterface {
/// try {
/// // your code...
/// } on Error catch (e, st) {
- /// Talker.instance.handleError(e, 'Error in ...', st);
+ /// talker.handleError(e, 'Error in ...', st);
/// }
/// ```
/// {@macro errorLevel}
@@ -100,7 +100,7 @@ abstract class TalkerInterface {
/// try {
/// // your code...
/// } on Error catch (e, st) {
- /// Talker.instance.handleException(e, 'Error in ...', st);
+ /// talker.handleException(e, 'Error in ...', st);
/// }
/// ```
/// {@macro errorLevel}
@@ -122,7 +122,7 @@ abstract class TalkerInterface {
/// your own further logic processing
/// [AnsiPen?] [pen] - sets your own log color for console
/// ```dart
- /// Talker.instance.log(
+ /// talker.log(
/// 'Server error',
/// logLevel: LogLevel.critical,
/// additional: {
@@ -164,7 +164,7 @@ abstract class TalkerInterface {
///
/// //You can add here response model of your request
/// final httpLog = HttpTalkerLog('Http status: 200');
- /// Talker.instance.logTyped(httpLog);
+ /// talker.logTyped(httpLog);
/// ```
/// {@endtemplate}
void logTyped(
@@ -179,7 +179,7 @@ abstract class TalkerInterface {
/// [StackTrace?] [stackTrace] - stackTrace if [exception] happened
///
/// ```dart
- /// Talker.instance.critical('Log critical');
+ /// talker.critical('Log critical');
/// ```
/// {@endtemplate}
void critical(
@@ -195,7 +195,7 @@ abstract class TalkerInterface {
/// [StackTrace?] [stackTrace] - stackTrace if [exception] happened
///
/// ```dart
- /// Talker.instance.error('Log error');
+ /// talker.error('Log error');
/// ```
/// {@endtemplate}
void error(
@@ -211,7 +211,7 @@ abstract class TalkerInterface {
/// [StackTrace?] [stackTrace] - stackTrace if [exception] happened
///
/// ```dart
- /// Talker.instance.debug('Log debug');
+ /// talker.debug('Log debug');
/// ```
/// {@endtemplate}
void debug(
@@ -227,7 +227,7 @@ abstract class TalkerInterface {
/// [StackTrace?] [stackTrace] - stackTrace if [exception] happened
///
/// ```dart
- /// Talker.instance.warning('Log warning');
+ /// talker.warning('Log warning');
/// ```
/// {@endtemplate}
void warning(
@@ -243,7 +243,7 @@ abstract class TalkerInterface {
/// [StackTrace?] [stackTrace] - stackTrace if [exception] happened
///
/// ```dart
- /// Talker.instance.verbose('Log verbose');
+ /// talker.verbose('Log verbose');
/// ```
/// {@endtemplate}
void verbose(
@@ -259,7 +259,7 @@ abstract class TalkerInterface {
/// [StackTrace?] [stackTrace] - stackTrace if [exception] happened
///
/// ```dart
- /// Talker.instance.info('Log info');
+ /// talker.info('Log info');
/// ```
/// {@endtemplate}
void info(
@@ -275,7 +275,7 @@ abstract class TalkerInterface {
/// [StackTrace?] [stackTrace] - stackTrace if [exception] happened
///
/// ```dart
- /// Talker.instance.fine('Log fine');
+ /// talker.fine('Log fine');
/// ```
/// {@endtemplate}
void fine(
@@ -291,7 +291,7 @@ abstract class TalkerInterface {
/// [StackTrace?] [stackTrace] - stackTrace if [exception] happened
///
/// ```dart
- /// Talker.instance.good('Log good');
+ /// talker.good('Log good');
/// ```
/// {@endtemplate}
void good(
diff --git a/packages/talker/pubspec.yaml b/packages/talker/pubspec.yaml
index 194c6ab3..e1e34033 100644
--- a/packages/talker/pubspec.yaml
+++ b/packages/talker/pubspec.yaml
@@ -1,6 +1,6 @@
name: talker
description: Advanced error handler and logger package for flutter and dart apps
-version: 0.8.1
+version: 0.9.0
homepage: https://github.com/Frezyx/talker
environment:
@@ -8,14 +8,7 @@ environment:
dependencies:
intl: ^0.17.0
- # talker_error_handler: ^0.5.0
- # path:
- # ../talker_error_handler
- # git:
- # url: https://github.com/Frezyx/talker
- # ref: testing
- # path: talker_error_handler/
- talker_logger: ">=0.8.0 <1.0.0"
+ talker_logger: ">=0.9.0 <1.0.0"
# path:
# ../talker_logger
# git:
diff --git a/packages/talker/test/talker_diable_test.dart b/packages/talker/test/talker_diable_test.dart
index b4c10f51..b92f7611 100644
--- a/packages/talker/test/talker_diable_test.dart
+++ b/packages/talker/test/talker_diable_test.dart
@@ -2,8 +2,9 @@ import 'package:talker/talker.dart';
import 'package:test/test.dart';
void main() {
+ final talker = Talker();
setUp(() {
- Talker.instance.cleanHistory();
+ talker.cleanHistory();
});
group('Talker_toggle_enabled', () {
@@ -11,22 +12,22 @@ void main() {
'history',
() {
test('disable', () {
- Talker.instance.disable();
- Talker.instance.error('Test disabled log');
+ talker.disable();
+ talker.error('Test disabled log');
- expect(Talker.instance.history, isEmpty);
+ expect(talker.history, isEmpty);
});
test('disable and enable', () {
- Talker.instance.disable();
- Talker.instance.error('Test disabled log');
+ talker.disable();
+ talker.error('Test disabled log');
- expect(Talker.instance.history, isEmpty);
+ expect(talker.history, isEmpty);
- Talker.instance.enable();
- Talker.instance.error('Test disabled log');
+ talker.enable();
+ talker.error('Test disabled log');
- expect(Talker.instance.history, isNotEmpty);
+ expect(talker.history, isNotEmpty);
});
},
);
diff --git a/packages/talker/test/talker_history_test.dart b/packages/talker/test/talker_history_test.dart
index 3296cd1d..af1ad7b4 100644
--- a/packages/talker/test/talker_history_test.dart
+++ b/packages/talker/test/talker_history_test.dart
@@ -6,25 +6,26 @@ void main() {
late TalkerInterface _talker;
setUp(() {
- _talker = Talker.instance;
+ _talker = Talker();
+
_talker.cleanHistory();
});
- test('ON', () async {
- await _configureTalker(useHistory: true, talker: _talker);
+ test('ON', () {
+ _configureTalker(useHistory: true, talker: _talker);
_makeLogs(_talker);
- final history = Talker.instance.history;
+ final history = _talker.history;
expect(history, isNotEmpty);
expect(history.length, equals(6));
});
- test('OFF', () async {
- await _configureTalker(useHistory: false, talker: _talker);
+ test('OFF', () {
+ _configureTalker(useHistory: false, talker: _talker);
_makeLogs(_talker);
- final history = Talker.instance.history;
+ final history = _talker.history;
expect(history, isEmpty);
});
@@ -40,11 +41,11 @@ void _makeLogs(TalkerInterface _talker) {
_talker.debug('Good log');
}
-Future _configureTalker({
+void _configureTalker({
required bool useHistory,
required TalkerInterface talker,
-}) async {
- await talker.configure(
+}) {
+ talker.configure(
settings: TalkerSettings(useHistory: useHistory, useConsoleLogs: false),
);
}
diff --git a/packages/talker/test/talker_settings_test.dart b/packages/talker/test/talker_settings_test.dart
index e1847578..503786af 100644
--- a/packages/talker/test/talker_settings_test.dart
+++ b/packages/talker/test/talker_settings_test.dart
@@ -2,9 +2,10 @@ import 'package:talker/talker.dart';
import 'package:test/test.dart';
void main() {
+ final talker = Talker();
group('Talker_Settings', () {
setUp(() {
- Talker.instance.cleanHistory();
+ talker.cleanHistory();
});
test('Register errors', () async {
@@ -12,26 +13,19 @@ void main() {
useConsoleLogs: false,
registeredTypes: [HttpTalkerLog],
);
- await _configureTalker(settings);
-
+ talker.configure(settings: settings);
final httpLog = HttpTalkerLog('Http good');
- Talker.instance.logTyped(httpLog);
+ talker.logTyped(httpLog);
expect(settings.registeredTypes, contains(httpLog.runtimeType));
expect(
- Talker.instance.history.whereType().isNotEmpty,
+ talker.history.whereType().isNotEmpty,
true,
);
});
});
}
-Future _configureTalker(TalkerSettings settings) async {
- await Talker.instance.configure(
- settings: settings,
- );
-}
-
class HttpTalkerLog extends TalkerLog {
HttpTalkerLog(String message) : super(message);
diff --git a/packages/talker_flutter/CHANGELOG.md b/packages/talker_flutter/CHANGELOG.md
index 265b57f5..b03af92d 100644
--- a/packages/talker_flutter/CHANGELOG.md
+++ b/packages/talker_flutter/CHANGELOG.md
@@ -1,3 +1,8 @@
+## 0.9.0
+ - **FEAT** Add expand button for hiding or revealing logs
+ - **FEAT** Update TalkerScreen log UI
+ - **FIX** Saving selected filters after sheet closing
+
## 0.8.1
- **talker_logger** update to 0.8.0 version
- talker_logger changes:
diff --git a/packages/talker_flutter/README.md b/packages/talker_flutter/README.md
index 8b55e735..213eef4a 100644
--- a/packages/talker_flutter/README.md
+++ b/packages/talker_flutter/README.md
@@ -1,39 +1,109 @@
-
+
+
+
+
-TODO: Put a short description of the package here that helps potential users
-know whether this package might be useful for them.
+
+
+
+
+
+
+How it works?
+Here is the general scheme of the package and its main features
+
+
+
-## Features
+On All Platforms
+
+ Please add Windows and Linux screenshots๐
+
+
+
+
-TODO: List what your package can do. Maybe include images, gifs, or videos.
+## Get Started
+Follow these steps to use this package
-## Getting started
+### Add dependency
+```yaml
+dependencies:
+ talker: ^0.9.0
+```
+
+### Easy to use
+You can use Talker instance everywhere in your app
+Simple and concise syntax will help you with this
+
+```dart
+final talker = Talker();
+// Handle exceptions and errors
+try {
+ // your code...
+} on Error catch (e, st) {
+ talker.handleError(e, st, 'Error in ...');
+}
+
+// Log your app info
+talker.log('App is started'),
+talker.error('App is started'),
+talker.waring('App is started'),
+///...
+```
+More examples you can get [there](https://github.com/Frezyx/talker/blob/master/packages/talker/example/talker_example.dart) or in [docs](https://github.com/Frezyx/talker/blob/master/packages/talker/lib/src/talker_interface.dart)
-TODO: List prerequisites and provide or point to information on how to
-start using the package.
+### Customization
+Configure the error handler and logger for yourself
+```dart
+final talker = Talker();
+// Handle exceptions and errors
+talker.configure(
+ /// Your own observers to handle errors's exception's and log's
+ observers: [],
+ settings: const TalkerSettings(
+ /// Your own registered types of error's exception's and log's
+ registeredTypes: [HttpTalkerLog],
+ maxHistoryItems: 1000,
+ useHistory: true,
+ useConsoleLogs: true,
+ ),
+ );
+```
+
+More examples you can get [there](https://github.com/Frezyx/talker/blob/master/packages/talker/example/talker_example.dart) or in [docs](https://github.com/Frezyx/talker/blob/master/packages/talker/lib/src/talker_interface.dart)
-## Usage
+## Use Talker Flutter
+Often you need to check what happening in the application when there is no console at hand. There is a talker_flutter package for this situations
-TODO: Include short and useful examples for package users. Add longer examples
-to `/example` folder.
+### Add dependency
+```yaml
+dependencies:
+ talker: ^0.9.0
+ talker_flutter: ^0.9.0
+```
+### Easy to use
+Add this code at something place of your Flutter application where you want to display logs
```dart
-const like = 'sample';
+final talker = Talker();
+TalkerScreen(talker: talker)
```
-## Additional information
+### Result
+
+
+
+For help getting started with ๐ Flutter, view
+[online documentation](https://flutter.dev/docs), which offers tutorials,
+samples, guidance on mobile development, and a full API reference.
-TODO: Tell users more about the package: where to find more information, how to
-contribute to the package, how to file issues, what response they can expect
-from the package authors, and more.
diff --git a/packages/talker_flutter/example/lib/main.dart b/packages/talker_flutter/example/lib/main.dart
index b77f6ce5..a4d505af 100644
--- a/packages/talker_flutter/example/lib/main.dart
+++ b/packages/talker_flutter/example/lib/main.dart
@@ -1,4 +1,4 @@
-import 'package:flutter/foundation.dart';
+import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:talker_flutter/talker_flutter.dart';
@@ -14,16 +14,18 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State {
+ late Talker _talker;
+
@override
void initState() {
- Talker.instance.configure(
+ _talker = Talker(
settings: TalkerSettings(writeToFile: false),
);
- _handleError();
- _handleException();
_fineLog();
_infoLog();
+ _handleError();
+ _handleException();
_warningLog();
_criticalLog();
_customLog();
@@ -38,101 +40,86 @@ class _MyAppState extends State {
primarySwatch: Colors.blue,
scaffoldBackgroundColor: Colors.grey[100],
),
- home: Stack(
- children: [
- TalkerScreen(
- talker: Talker.instance,
+ home: Builder(builder: (context) {
+ return Scaffold(
+ body: TalkerScreen(
+ talker: _talker,
),
- Align(
- alignment: Alignment.bottomCenter,
- child: Container(
- height: kIsWeb ? 100 : 170,
- width: 600,
- color: Colors.grey[850],
- padding: const EdgeInsets.all(10),
- child: Wrap(
- spacing: 10,
- runSpacing: 10,
- children: [
- BarButton(
- title: 'Handle Error',
- onTap: _handleError,
- ),
- BarButton(
- title: 'Handle Exception',
- onTap: _handleException,
- ),
- BarButton(
- title: 'Fine Log',
- onTap: _fineLog,
- ),
- BarButton(
- title: 'Info Log',
- onTap: _infoLog,
- ),
- BarButton(
- title: 'Waring Log',
- onTap: _warningLog,
- ),
- BarButton(
- title: 'Varning Log',
- onTap: _verboseLog,
- ),
- BarButton(
- title: 'Big Critical log',
- onTap: _criticalLog,
- ),
- BarButton(
- title: 'Custom log',
- onTap: _customLog,
- ),
- ],
- ),
- ),
- )
- ],
- ),
+ floatingActionButton: FloatingActionButton(
+ onPressed: () => _showLogMaker(context),
+ child: const Icon(Icons.bug_report),
+ ),
+ );
+ }),
);
}
void _handleError() {
- Talker.instance.handleError(ArgumentError('-6 is not positive number'));
+ try {
+ throw ArgumentError('-6 is not positive number');
+ } catch (e, st) {
+ _talker.handle(e, st, 'Something wrong in calculation');
+ }
}
void _handleException() {
- Talker.instance.handleException(Exception('Not connected'));
+ try {
+ throw Exception('Test service exception');
+ } catch (e, st) {
+ _talker.handle(e, st, 'FakeService excetion');
+ }
}
void _fineLog() {
- Talker.instance.fine(
- 'Service send good request',
- );
+ _talker.fine('Service send good request');
}
void _infoLog() {
- Talker.instance.info('Renew token from expire date');
+ _talker.info('Renew token from expire date');
}
void _verboseLog() {
- Talker.instance.verbose(
- 'Cache images working slowly on this platform',
- );
+ _talker.verbose('Cache images working slowly on this platform');
}
void _warningLog() {
- Talker.instance.warning(
- 'Cache images working slowly on this platform',
- );
+ _talker.warning('Cache images working slowly on this platform');
}
void _customLog() {
- Talker.instance.logTyped(
- CustomLog('Custom log message'),
- );
+ _talker.logTyped(CustomLog('Custom log message'));
}
void _criticalLog() {
- Talker.instance.log('Server exception', logLevel: LogLevel.critical);
+ _talker.log('Server exception', logLevel: LogLevel.critical);
+ }
+
+ void _showLogMaker(BuildContext context) {
+ showCupertinoModalPopup(
+ context: context,
+ builder: (context) => Container(
+ padding: const EdgeInsets.all(10),
+ margin: const EdgeInsets.symmetric(vertical: 10),
+ decoration: BoxDecoration(
+ color: Colors.grey[850]?.withOpacity(0.9),
+ borderRadius: BorderRadius.circular(6),
+ ),
+ child: Wrap(
+ spacing: 10,
+ runSpacing: 10,
+ children: [
+ BarButton(title: 'Handle Error', onTap: _handleError),
+ BarButton(title: 'Handle Exception', onTap: _handleException),
+ BarButton(title: 'Fine Log', onTap: _fineLog),
+ BarButton(title: 'Info Log', onTap: _infoLog),
+ BarButton(title: 'Waring Log', onTap: _warningLog),
+ BarButton(title: 'Varning Log', onTap: _verboseLog),
+ BarButton(title: 'Big Critical log', onTap: _criticalLog),
+ BarButton(title: 'Custom log', onTap: _customLog),
+ ],
+ ),
+ ),
+ );
}
}
@@ -163,9 +150,8 @@ class BarButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return MaterialButton(
+ return ElevatedButton(
onPressed: onTap,
- color: Theme.of(context).primaryColor,
child: Text(
title,
style: const TextStyle(
diff --git a/packages/talker_flutter/example/pubspec.lock b/packages/talker_flutter/example/pubspec.lock
index 69d21f34..43999e26 100644
--- a/packages/talker_flutter/example/pubspec.lock
+++ b/packages/talker_flutter/example/pubspec.lock
@@ -87,7 +87,7 @@ packages:
name: group_button
url: "https://pub.dartlang.org"
source: hosted
- version: "4.5.0"
+ version: "4.8.0"
intl:
dependency: transitive
description:
@@ -169,21 +169,21 @@ packages:
name: talker
url: "https://pub.dartlang.org"
source: hosted
- version: "0.8.1"
+ version: "0.9.0"
talker_flutter:
dependency: "direct main"
description:
path: ".."
relative: true
source: path
- version: "0.8.1"
+ version: "0.9.0"
talker_logger:
dependency: transitive
description:
name: talker_logger
url: "https://pub.dartlang.org"
source: hosted
- version: "0.8.0"
+ version: "0.9.0"
term_glyph:
dependency: transitive
description:
diff --git a/packages/talker_flutter/lib/src/controller/talker_screen_controller.dart b/packages/talker_flutter/lib/src/controller/talker_screen_controller.dart
index 048dfe6f..0eb72e8f 100644
--- a/packages/talker_flutter/lib/src/controller/talker_screen_controller.dart
+++ b/packages/talker_flutter/lib/src/controller/talker_screen_controller.dart
@@ -8,6 +8,8 @@ class TalkerScreenController extends ChangeNotifier {
types: [],
);
+ var _expandedLogs = true;
+
/// Filter for selecting specific logs and errors
TalkerFilter get filter => _filter;
set filter(TalkerFilter val) {
@@ -15,6 +17,14 @@ class TalkerScreenController extends ChangeNotifier {
notifyListeners();
}
+ bool get expandedLogs => _expandedLogs;
+ set expandedLogs(bool val) {
+ if (val != _expandedLogs) {
+ _expandedLogs = val;
+ notifyListeners();
+ }
+ }
+
/// Method for updating a search query based on errors and logs
void updateFilterSearchQuery(String query) {
_filter = _filter.copyWith(searchQuery: query);
diff --git a/packages/talker_flutter/lib/src/extensions/log_level.dart b/packages/talker_flutter/lib/src/extensions/log_level.dart
index 2678b21e..a1ce9a47 100644
--- a/packages/talker_flutter/lib/src/extensions/log_level.dart
+++ b/packages/talker_flutter/lib/src/extensions/log_level.dart
@@ -6,18 +6,19 @@ extension ToColor on LogLevel? {
Color get color {
switch (this) {
case LogLevel.critical:
+ return Colors.red[800]!;
case LogLevel.error:
- return Colors.red;
+ return Colors.red[400]!;
case LogLevel.fine:
- return Colors.teal;
+ return Colors.teal[400]!;
case LogLevel.warning:
- return Colors.orange;
+ return Colors.orange[800]!;
case LogLevel.verbose:
- return Colors.grey;
+ return Colors.grey[400]!;
case LogLevel.info:
- return Colors.blue;
+ return Colors.blue[400]!;
case LogLevel.good:
- return Colors.green;
+ return Colors.green[400]!;
case LogLevel.debug:
default:
return Colors.grey;
diff --git a/packages/talker_flutter/lib/src/options/options.dart b/packages/talker_flutter/lib/src/options/options.dart
deleted file mode 100644
index 0e92a003..00000000
--- a/packages/talker_flutter/lib/src/options/options.dart
+++ /dev/null
@@ -1 +0,0 @@
-export 'talker_screen_options.dart';
diff --git a/packages/talker_flutter/lib/src/src.dart b/packages/talker_flutter/lib/src/src.dart
index 64336636..af4f3107 100644
--- a/packages/talker_flutter/lib/src/src.dart
+++ b/packages/talker_flutter/lib/src/src.dart
@@ -1,4 +1,4 @@
export 'talker_screen.dart';
export 'extensions/extensions.dart';
export 'models/models.dart';
-export 'options/options.dart';
+export 'theme/theme.dart';
diff --git a/packages/talker_flutter/lib/src/talker_screen.dart b/packages/talker_flutter/lib/src/talker_screen.dart
index 3cf448ee..45e512ff 100644
--- a/packages/talker_flutter/lib/src/talker_screen.dart
+++ b/packages/talker_flutter/lib/src/talker_screen.dart
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:group_button/group_button.dart';
import 'package:talker_flutter/src/controller/talker_screen_controller.dart';
import 'package:talker_flutter/src/widgets/widgets.dart';
import 'package:talker_flutter/talker_flutter.dart';
@@ -9,11 +10,11 @@ class TalkerScreen extends StatefulWidget {
const TalkerScreen({
Key? key,
required this.talker,
- this.options = const TalkerScreenOptions(),
+ this.theme = const TalkerScreenTheme(),
}) : super(key: key);
final TalkerInterface talker;
- final TalkerScreenOptions options;
+ final TalkerScreenTheme theme;
@override
State createState() => _TalkerScreenState();
@@ -21,6 +22,8 @@ class TalkerScreen extends StatefulWidget {
class _TalkerScreenState extends State {
final _controller = TalkerScreenController();
+ final _typesController = GroupButtonController();
+ final _titilesController = GroupButtonController();
@override
Widget build(BuildContext context) {
@@ -28,10 +31,23 @@ class _TalkerScreenState extends State {
animation: _controller,
builder: (context, child) {
return Scaffold(
- backgroundColor: widget.options.backgroudColor,
+ backgroundColor: widget.theme.backgroudColor,
appBar: AppBar(
title: const Text('Flutter talker'),
actions: [
+ SizedBox(
+ width: 40,
+ child: IconButton(
+ padding: EdgeInsets.zero,
+ iconSize: 28,
+ onPressed: _toggleLogsExpanded,
+ icon: Icon(
+ _controller.expandedLogs
+ ? Icons.visibility_outlined
+ : Icons.visibility_off_outlined,
+ ),
+ ),
+ ),
SizedBox(
width: 40,
child: IconButton(
@@ -75,7 +91,8 @@ class _TalkerScreenState extends State {
return TalkerDataCard(
data: data,
onTap: () => _copyTalkerDataItemText(data),
- options: widget.options,
+ options: widget.theme,
+ expanded: _controller.expandedLogs,
);
},
);
@@ -102,19 +119,26 @@ class _TalkerScreenState extends State {
builder: (context) {
return TalkerScreenFilter(
controller: _controller,
- options: widget.options,
+ talkerScreenTheme: widget.theme,
+ talker: widget.talker,
+ typesController: _typesController,
+ titlesController: _titilesController,
);
},
);
}
void _cleanHistory() {
- Talker.instance.cleanHistory();
+ widget.talker.cleanHistory();
_controller.update();
}
+ void _toggleLogsExpanded() {
+ _controller.expandedLogs = !_controller.expandedLogs;
+ }
+
void _copyAllLogs(BuildContext context) {
- Clipboard.setData(ClipboardData(text: Talker.instance.history.text));
+ Clipboard.setData(ClipboardData(text: widget.talker.history.text));
_showSnackBar(context, 'All logs copied in buffer');
}
diff --git a/packages/talker_flutter/lib/src/options/talker_screen_options.dart b/packages/talker_flutter/lib/src/theme/talker_screen_theme.dart
similarity index 83%
rename from packages/talker_flutter/lib/src/options/talker_screen_options.dart
rename to packages/talker_flutter/lib/src/theme/talker_screen_theme.dart
index 0844f2f9..26b05205 100644
--- a/packages/talker_flutter/lib/src/options/talker_screen_options.dart
+++ b/packages/talker_flutter/lib/src/theme/talker_screen_theme.dart
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
/// Configuring the UI of [TalkerScreen]
-class TalkerScreenOptions {
- const TalkerScreenOptions({
+class TalkerScreenTheme {
+ const TalkerScreenTheme({
this.backgroudColor = const Color(0xFF212121),
this.textColor = Colors.white,
});
diff --git a/packages/talker_flutter/lib/src/theme/theme.dart b/packages/talker_flutter/lib/src/theme/theme.dart
new file mode 100644
index 00000000..e820eda4
--- /dev/null
+++ b/packages/talker_flutter/lib/src/theme/theme.dart
@@ -0,0 +1 @@
+export 'talker_screen_theme.dart';
diff --git a/packages/talker_flutter/lib/src/widgets/cards/talker_data_card.dart b/packages/talker_flutter/lib/src/widgets/cards/talker_data_card.dart
index 3614f666..cc7ed29e 100644
--- a/packages/talker_flutter/lib/src/widgets/cards/talker_data_card.dart
+++ b/packages/talker_flutter/lib/src/widgets/cards/talker_data_card.dart
@@ -7,11 +7,13 @@ class TalkerDataCard extends StatelessWidget {
required this.data,
required this.onTap,
required this.options,
+ required this.expanded,
}) : super(key: key);
- final TalkerScreenOptions options;
+ final TalkerScreenTheme options;
final TalkerDataInterface data;
final Function() onTap;
+ final bool expanded;
@override
Widget build(BuildContext context) {
@@ -37,6 +39,7 @@ class TalkerDataCard extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
RichText(
+ maxLines: expanded ? null : 1,
text: TextSpan(
text: 'Message ',
style: TextStyle(
@@ -53,24 +56,24 @@ class TalkerDataCard extends StatelessWidget {
],
),
),
- RichText(
- text: TextSpan(
- text: 'Time ',
- style: TextStyle(
- color: _color,
- fontWeight: FontWeight.bold,
- ),
- children: [
- TextSpan(
- text: data.displayTime,
- style: const TextStyle(
- fontWeight: FontWeight.normal,
- ),
- ),
- ],
- ),
- ),
- if (data.stackTrace != null)
+ // RichText(
+ // text: TextSpan(
+ // text: 'Time ',
+ // style: TextStyle(
+ // color: _color,
+ // fontWeight: FontWeight.bold,
+ // ),
+ // children: [
+ // TextSpan(
+ // text: data.displayTime,
+ // style: const TextStyle(
+ // fontWeight: FontWeight.normal,
+ // ),
+ // ),
+ // ],
+ // ),
+ // ),
+ if (data.stackTrace != null && expanded)
RichText(
text: TextSpan(
text: 'StackTrace ',
@@ -93,6 +96,7 @@ class TalkerDataCard extends StatelessWidget {
),
SizedBox(
width: 26,
+ height: 26,
child: IconButton(
iconSize: 20,
onPressed: onTap,
diff --git a/packages/talker_flutter/lib/src/widgets/filter/talker_screen_filter.dart b/packages/talker_flutter/lib/src/widgets/filter/talker_screen_filter.dart
index 8f01a7ea..51bcf198 100644
--- a/packages/talker_flutter/lib/src/widgets/filter/talker_screen_filter.dart
+++ b/packages/talker_flutter/lib/src/widgets/filter/talker_screen_filter.dart
@@ -7,11 +7,17 @@ class TalkerScreenFilter extends StatelessWidget {
const TalkerScreenFilter({
Key? key,
required this.controller,
- required this.options,
+ required this.talkerScreenTheme,
+ required this.talker,
+ required this.typesController,
+ required this.titlesController,
}) : super(key: key);
final TalkerScreenController controller;
- final TalkerScreenOptions options;
+ final TalkerScreenTheme talkerScreenTheme;
+ final TalkerInterface talker;
+ final GroupButtonController typesController;
+ final GroupButtonController titlesController;
@override
Widget build(BuildContext context) {
@@ -20,14 +26,14 @@ class TalkerScreenFilter extends StatelessWidget {
final theme = Theme.of(context);
return Container(
decoration: BoxDecoration(
- color: options.backgroudColor,
+ color: talkerScreenTheme.backgroudColor,
borderRadius: BorderRadius.circular(10),
),
child: Column(
children: [
Container(
decoration: BoxDecoration(
- color: options.backgroudColor,
+ color: talkerScreenTheme.backgroudColor,
borderRadius: const BorderRadius.vertical(
top: Radius.circular(10),
),
@@ -40,13 +46,13 @@ class TalkerScreenFilter extends StatelessWidget {
Text(
'Talker Filter',
style: theme.textTheme.headline6!
- .copyWith(color: options.textColor),
+ .copyWith(color: talkerScreenTheme.textColor),
),
InkWell(
onTap: () => Navigator.pop(context),
child: Icon(
Icons.close_rounded,
- color: options.textColor,
+ color: talkerScreenTheme.textColor,
),
),
],
@@ -61,25 +67,28 @@ class TalkerScreenFilter extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: TextFormField(
style: theme.textTheme.bodyText1!.copyWith(
- color: options.textColor,
+ color: talkerScreenTheme.textColor,
),
onChanged: controller.updateFilterSearchQuery,
decoration: InputDecoration(
+ fillColor: theme.cardColor,
enabledBorder: OutlineInputBorder(
- borderSide: BorderSide(color: options.textColor),
+ borderSide:
+ BorderSide(color: talkerScreenTheme.textColor),
borderRadius: BorderRadius.circular(10),
),
border: OutlineInputBorder(
- borderSide: BorderSide(color: options.textColor),
+ borderSide:
+ BorderSide(color: talkerScreenTheme.textColor),
borderRadius: BorderRadius.circular(10),
),
prefixIcon: Icon(
Icons.search,
- color: options.textColor,
+ color: talkerScreenTheme.textColor,
),
hintText: 'Search...',
hintStyle: theme.textTheme.bodyText1!.copyWith(
- color: options.textColor,
+ color: talkerScreenTheme.textColor,
),
),
),
@@ -90,7 +99,7 @@ class TalkerScreenFilter extends StatelessWidget {
child: Text(
'Titles',
style: theme.textTheme.headline6!.copyWith(
- color: options.textColor,
+ color: talkerScreenTheme.textColor,
),
),
),
@@ -100,6 +109,7 @@ class TalkerScreenFilter extends StatelessWidget {
child: GroupButton(
isRadio: false,
buttons: titles,
+ controller: titlesController,
onSelected: (i, selected) {
_onToggleTitle(titles[i], selected);
},
@@ -115,7 +125,7 @@ class TalkerScreenFilter extends StatelessWidget {
child: Text(
'Types',
style: theme.textTheme.headline6!.copyWith(
- color: options.textColor,
+ color: talkerScreenTheme.textColor,
),
),
),
@@ -124,6 +134,7 @@ class TalkerScreenFilter extends StatelessWidget {
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: GroupButton(
isRadio: false,
+ controller: typesController,
buttons: types.map((e) => e.toString()).toList(),
onSelected: (i, selected) {
_onToggleType(types[i], selected);
@@ -159,10 +170,10 @@ class TalkerScreenFilter extends StatelessWidget {
}
Set get unicTypes {
- return Talker.instance.history.map((e) => e.runtimeType).toSet();
+ return talker.history.map((e) => e.runtimeType).toSet();
}
Set get unicTitles {
- return Talker.instance.history.map((e) => e.displayTitle).toSet();
+ return talker.history.map((e) => e.displayTitle).toSet();
}
}
diff --git a/packages/talker_flutter/pubspec.yaml b/packages/talker_flutter/pubspec.yaml
index 41373f71..78d5bde5 100644
--- a/packages/talker_flutter/pubspec.yaml
+++ b/packages/talker_flutter/pubspec.yaml
@@ -1,6 +1,6 @@
name: talker_flutter
description: Flutter implementation of talker (advanced error handler and logger package).
-version: 0.8.1
+version: 0.9.0
homepage: https://github.com/Frezyx/talker
environment:
@@ -11,7 +11,7 @@ dependencies:
flutter:
sdk: flutter
- talker: ^0.8.1
+ talker: ^0.9.0
# path:
# ../talker
# git:
@@ -19,7 +19,7 @@ dependencies:
# ref: testing
# path: talker/
- group_button: ^4.5.0
+ group_button: ^4.8.0
dev_dependencies:
flutter_test:
diff --git a/packages/talker_logger/CHANGELOG.md b/packages/talker_logger/CHANGELOG.md
index 9fe89ac7..e5d09fbf 100644
--- a/packages/talker_logger/CHANGELOG.md
+++ b/packages/talker_logger/CHANGELOG.md
@@ -1,3 +1,6 @@
+## 0.9.0
+- **INFO**: Make small refactor
+
## 0.8.0
- **INFO**: Create README with documentation and examples
- **INFO**: Add TalkerLoggerSettings docs
diff --git a/packages/talker_logger/pubspec.yaml b/packages/talker_logger/pubspec.yaml
index bc2cc278..8213138e 100644
--- a/packages/talker_logger/pubspec.yaml
+++ b/packages/talker_logger/pubspec.yaml
@@ -1,6 +1,6 @@
name: talker_logger
description: Logger core package for talker (advanced error handler and logger package)
-version: 0.8.0
+version: 0.9.0
homepage: https://github.com/Frezyx/talker
environment: