From 779b426c4f166251ae3348bfa96cb5636496c35f Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 17:55:36 +0300 Subject: [PATCH 01/38] Rename ErrorContainer -> ErrorDetails --- talker/lib/src/talker_interface.dart | 1 - .../lib/src/error_handler.dart | 22 +++++++++---------- .../lib/src/error_handler_interface.dart | 10 ++++----- .../lib/src/extensions/stream.dart | 20 ++++++++--------- .../base_error_details.dart} | 8 +++---- .../error_details.dart} | 4 ++-- .../error_handler_settings.dart | 2 +- .../lib/src/models/models.dart | 2 +- 8 files changed, 34 insertions(+), 35 deletions(-) rename talker_error_handler/lib/src/models/{error_container/base_error_container.dart => error_details/base_error_details.dart} (84%) rename talker_error_handler/lib/src/models/{error_container/error_container.dart => error_details/error_details.dart} (79%) diff --git a/talker/lib/src/talker_interface.dart b/talker/lib/src/talker_interface.dart index 2efc26ff..4623503c 100644 --- a/talker/lib/src/talker_interface.dart +++ b/talker/lib/src/talker_interface.dart @@ -1,5 +1,4 @@ import 'package:talker/talker.dart'; -import 'package:talker_error_handler/talker_error_handler.dart'; abstract class TalkerInterface { Stream get stream; diff --git a/talker_error_handler/lib/src/error_handler.dart b/talker_error_handler/lib/src/error_handler.dart index 38e1adcc..2539fd0d 100644 --- a/talker_error_handler/lib/src/error_handler.dart +++ b/talker_error_handler/lib/src/error_handler.dart @@ -23,17 +23,17 @@ class ErrorHandler implements ErrorHandlerInterface { ErrorLevel? errorLevel, )? onUnknownErrorType; - final _controller = StreamController.broadcast(); - final _history = []; + final _controller = StreamController.broadcast(); + final _history = []; @override - Stream get stream => _controller.stream.asBroadcastStream(); + Stream get stream => _controller.stream.asBroadcastStream(); @override - List get history => _history; + List get history => _history; @override - ErrorContainer? handle( + ErrorDetails? handle( String msg, [ Object? exception, StackTrace? stackTrace, @@ -49,13 +49,13 @@ class ErrorHandler implements ErrorHandlerInterface { } @override - ErrorContainer handleError( + ErrorDetails handleError( String msg, [ Error? error, StackTrace? stackTrace, ErrorLevel? errorLevel, ]) { - final container = BaseErrorContainer( + final container = BaseErrorDetails( msg, error: error, stackTrace: stackTrace, @@ -66,13 +66,13 @@ class ErrorHandler implements ErrorHandlerInterface { } @override - ErrorContainer handleException( + ErrorDetails handleException( String msg, [ Exception? exception, StackTrace? stackTrace, ErrorLevel? errorLevel, ]) { - final container = BaseErrorContainer( + final container = BaseErrorDetails( msg, exception: exception, stackTrace: stackTrace, @@ -82,7 +82,7 @@ class ErrorHandler implements ErrorHandlerInterface { return container; } - void _handle(ErrorContainer container) { + void _handle(ErrorDetails container) { //TODO: fix type checking final errLvl = _registeredErrors[container.runtimeType]; if (errLvl != null && container.errorLevel == null) { @@ -92,7 +92,7 @@ class ErrorHandler implements ErrorHandlerInterface { _handleForHistory(container); } - void _handleForHistory(ErrorContainer container) { + void _handleForHistory(ErrorDetails container) { if (settings.useHistory) { if (settings.maxHistoryEntries <= _history.length) { _history.removeAt(0); diff --git a/talker_error_handler/lib/src/error_handler_interface.dart b/talker_error_handler/lib/src/error_handler_interface.dart index 01d57a7b..9abcb8ce 100644 --- a/talker_error_handler/lib/src/error_handler_interface.dart +++ b/talker_error_handler/lib/src/error_handler_interface.dart @@ -1,24 +1,24 @@ import 'package:talker_error_handler/talker_error_handler.dart'; abstract class ErrorHandlerInterface { - Stream get stream; - List get history; + Stream get stream; + List get history; - ErrorContainer? handle( + ErrorDetails? handle( String msg, [ Object? exception, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); - ErrorContainer handleError( + ErrorDetails handleError( String msg, [ Error? error, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); - ErrorContainer handleException( + ErrorDetails handleException( String msg, [ Exception? exception, StackTrace? stackTrace, diff --git a/talker_error_handler/lib/src/extensions/stream.dart b/talker_error_handler/lib/src/extensions/stream.dart index 76f4940d..86093249 100644 --- a/talker_error_handler/lib/src/extensions/stream.dart +++ b/talker_error_handler/lib/src/extensions/stream.dart @@ -1,26 +1,26 @@ import 'package:talker_error_handler/talker_error_handler.dart'; -extension DebugErrorsStream on Stream { - Stream get debug => +extension DebugErrorsStream on Stream { + Stream get debug => where((e) => e.errorLevel == ErrorLevel.debug); } -extension CriticalErrorsStream on Stream { - Stream get critical => +extension CriticalErrorsStream on Stream { + Stream get critical => where((e) => e.errorLevel == ErrorLevel.critical); } -extension InfoErrorsStream on Stream { - Stream get info => +extension InfoErrorsStream on Stream { + Stream get info => where((e) => e.errorLevel == ErrorLevel.info); } -extension WarningErrorsStream on Stream { - Stream get warning => +extension WarningErrorsStream on Stream { + Stream get warning => where((e) => e.errorLevel == ErrorLevel.warning); } -extension TinyErrorsStream on Stream { - Stream get tiny => +extension TinyErrorsStream on Stream { + Stream get tiny => where((e) => e.errorLevel == ErrorLevel.tiny); } diff --git a/talker_error_handler/lib/src/models/error_container/base_error_container.dart b/talker_error_handler/lib/src/models/error_details/base_error_details.dart similarity index 84% rename from talker_error_handler/lib/src/models/error_container/base_error_container.dart rename to talker_error_handler/lib/src/models/error_details/base_error_details.dart index 6718cd34..b9013fa1 100644 --- a/talker_error_handler/lib/src/models/error_container/base_error_container.dart +++ b/talker_error_handler/lib/src/models/error_details/base_error_details.dart @@ -2,8 +2,8 @@ import 'package:talker_error_handler/talker_error_handler.dart'; /// Base error container // TODO: rename -class BaseErrorContainer implements ErrorContainer { - BaseErrorContainer( +class BaseErrorDetails implements ErrorDetails { + BaseErrorDetails( this.message, { this.exception, this.error, @@ -26,14 +26,14 @@ class BaseErrorContainer implements ErrorContainer { @override ErrorLevel? errorLevel; - BaseErrorContainer copyWith({ + BaseErrorDetails copyWith({ String? message, Exception? exception, Error? error, StackTrace? stackTrace, ErrorLevel? errorLevel, }) { - return BaseErrorContainer( + return BaseErrorDetails( message ?? this.message, exception: exception ?? this.exception, error: error ?? this.error, diff --git a/talker_error_handler/lib/src/models/error_container/error_container.dart b/talker_error_handler/lib/src/models/error_details/error_details.dart similarity index 79% rename from talker_error_handler/lib/src/models/error_container/error_container.dart rename to talker_error_handler/lib/src/models/error_details/error_details.dart index c650e02a..1d9ab087 100644 --- a/talker_error_handler/lib/src/models/error_container/error_container.dart +++ b/talker_error_handler/lib/src/models/error_details/error_details.dart @@ -1,9 +1,9 @@ //TODO: Container or wrapper import 'package:talker_error_handler/talker_error_handler.dart'; -export 'base_error_container.dart'; +export 'base_error_details.dart'; -abstract class ErrorContainer { +abstract class ErrorDetails { String get message; Exception? get exception; Error? get error; diff --git a/talker_error_handler/lib/src/models/error_handler_settings/error_handler_settings.dart b/talker_error_handler/lib/src/models/error_handler_settings/error_handler_settings.dart index 7edf1022..8843f122 100644 --- a/talker_error_handler/lib/src/models/error_handler_settings/error_handler_settings.dart +++ b/talker_error_handler/lib/src/models/error_handler_settings/error_handler_settings.dart @@ -2,7 +2,7 @@ import 'package:talker_error_handler/talker_error_handler.dart'; const kDefaultErrorHandlerSettings = ErrorHandlerSettings(); const kDefaultRegisteredErrors = { - BaseErrorContainer: ErrorLevel.debug, + BaseErrorDetails: ErrorLevel.debug, }; class ErrorHandlerSettings { diff --git a/talker_error_handler/lib/src/models/models.dart b/talker_error_handler/lib/src/models/models.dart index ae965668..b6d0605e 100644 --- a/talker_error_handler/lib/src/models/models.dart +++ b/talker_error_handler/lib/src/models/models.dart @@ -1,3 +1,3 @@ -export 'error_container/error_container.dart'; +export 'error_details/error_details.dart'; export 'error_handler_settings/error_handler_settings.dart'; export 'error_level/error_level.dart'; From ea5c488b7c223f53390dfb17018143055d525f35 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 18:03:47 +0300 Subject: [PATCH 02/38] Update error handler Api --- talker/lib/src/talker_interface.dart | 26 +++++++++---------- .../example/error_handler_core_example.dart | 6 ++--- .../lib/src/error_handler.dart | 22 ++++++++-------- .../lib/src/error_handler_interface.dart | 18 ++++++------- .../error_details/base_error_details.dart | 8 +++--- .../models/error_details/error_details.dart | 2 +- .../test/errorhandler_handle_error_test.dart | 6 ++--- .../errorhandler_handle_exception_test.dart | 6 ++--- .../test/errorhandler_history_test.dart | 6 ++--- 9 files changed, 50 insertions(+), 50 deletions(-) diff --git a/talker/lib/src/talker_interface.dart b/talker/lib/src/talker_interface.dart index 4623503c..6b4dbc53 100644 --- a/talker/lib/src/talker_interface.dart +++ b/talker/lib/src/talker_interface.dart @@ -4,37 +4,37 @@ abstract class TalkerInterface { Stream get stream; List get history; + Future configure({ + TalkerSettings? settings, + List? observers, + }); + void handle( - String msg, [ - Object? exception, + Object exception, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); void handleError( - String msg, [ - Error? error, + Error? error, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); void handleException( - String msg, [ - Exception? exception, + Exception? exception, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); void log( - String message, - LogLevel logLevel, { + String message, { + LogLevel logLevel = LogLevel.debug, Map? additional, }); void cleanHistory(); - - Future configure({ - TalkerSettings? settings, - List? observers, - }); } diff --git a/talker_error_handler/example/error_handler_core_example.dart b/talker_error_handler/example/error_handler_core_example.dart index ab4ad451..d4ef1508 100644 --- a/talker_error_handler/example/error_handler_core_example.dart +++ b/talker_error_handler/example/error_handler_core_example.dart @@ -23,16 +23,16 @@ void main() { errorHandler ..handle( - 'Test custom exception', HttpException(), + 'Test custom exception', ) ..handle( - 'Test error', ArgumentError(), + 'Test error', ) ..handle( - 'Test critical exception', Exception(), + 'Test critical exception', null, ErrorLevel.critical, ); diff --git a/talker_error_handler/lib/src/error_handler.dart b/talker_error_handler/lib/src/error_handler.dart index 2539fd0d..bec5a77e 100644 --- a/talker_error_handler/lib/src/error_handler.dart +++ b/talker_error_handler/lib/src/error_handler.dart @@ -17,7 +17,7 @@ class ErrorHandler implements ErrorHandlerInterface { final ErrorHandlerSettings settings; final Map _registeredErrors = {}; final Function( - String msg, + String? msg, Object? exception, StackTrace? stackTrace, ErrorLevel? errorLevel, @@ -34,15 +34,15 @@ class ErrorHandler implements ErrorHandlerInterface { @override ErrorDetails? handle( - String msg, [ - Object? exception, + Object exception, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]) { if (exception is Exception) { - return handleException(msg, exception, stackTrace, errorLevel); + return handleException(exception, msg, stackTrace, errorLevel); } else if (exception is Error) { - return handleError(msg, exception, stackTrace, errorLevel); + return handleError(exception, msg, stackTrace, errorLevel); } else { onUnknownErrorType?.call(msg, exception, stackTrace, errorLevel); } @@ -50,13 +50,13 @@ class ErrorHandler implements ErrorHandlerInterface { @override ErrorDetails handleError( - String msg, [ - Error? error, + Error error, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]) { final container = BaseErrorDetails( - msg, + message: msg, error: error, stackTrace: stackTrace, errorLevel: errorLevel, @@ -67,13 +67,13 @@ class ErrorHandler implements ErrorHandlerInterface { @override ErrorDetails handleException( - String msg, [ - Exception? exception, + Exception exception, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]) { final container = BaseErrorDetails( - msg, + message: msg, exception: exception, stackTrace: stackTrace, errorLevel: errorLevel, diff --git a/talker_error_handler/lib/src/error_handler_interface.dart b/talker_error_handler/lib/src/error_handler_interface.dart index 9abcb8ce..a8ff2913 100644 --- a/talker_error_handler/lib/src/error_handler_interface.dart +++ b/talker_error_handler/lib/src/error_handler_interface.dart @@ -4,23 +4,23 @@ abstract class ErrorHandlerInterface { Stream get stream; List get history; - ErrorDetails? handle( - String msg, [ - Object? exception, + void handle( + Object exception, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); - ErrorDetails handleError( - String msg, [ - Error? error, + void handleError( + Error error, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); - ErrorDetails handleException( - String msg, [ - Exception? exception, + void handleException( + Exception exception, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); diff --git a/talker_error_handler/lib/src/models/error_details/base_error_details.dart b/talker_error_handler/lib/src/models/error_details/base_error_details.dart index b9013fa1..0796f0f4 100644 --- a/talker_error_handler/lib/src/models/error_details/base_error_details.dart +++ b/talker_error_handler/lib/src/models/error_details/base_error_details.dart @@ -3,16 +3,16 @@ import 'package:talker_error_handler/talker_error_handler.dart'; /// Base error container // TODO: rename class BaseErrorDetails implements ErrorDetails { - BaseErrorDetails( - this.message, { + BaseErrorDetails({ this.exception, + this.message, this.error, this.stackTrace, this.errorLevel, }); @override - final String message; + final String? message; @override final Exception? exception; @@ -34,7 +34,7 @@ class BaseErrorDetails implements ErrorDetails { ErrorLevel? errorLevel, }) { return BaseErrorDetails( - message ?? this.message, + message: message ?? this.message, exception: exception ?? this.exception, error: error ?? this.error, stackTrace: stackTrace ?? this.stackTrace, diff --git a/talker_error_handler/lib/src/models/error_details/error_details.dart b/talker_error_handler/lib/src/models/error_details/error_details.dart index 1d9ab087..64151618 100644 --- a/talker_error_handler/lib/src/models/error_details/error_details.dart +++ b/talker_error_handler/lib/src/models/error_details/error_details.dart @@ -4,7 +4,7 @@ import 'package:talker_error_handler/talker_error_handler.dart'; export 'base_error_details.dart'; abstract class ErrorDetails { - String get message; + String? get message; Exception? get exception; Error? get error; StackTrace? get stackTrace; diff --git a/talker_error_handler/test/errorhandler_handle_error_test.dart b/talker_error_handler/test/errorhandler_handle_error_test.dart index de57903b..4b50bb02 100644 --- a/talker_error_handler/test/errorhandler_handle_error_test.dart +++ b/talker_error_handler/test/errorhandler_handle_error_test.dart @@ -10,7 +10,7 @@ void main() { setUp(() => errorHandler = ErrorHandler()); test('Handle_Error', () { - errorHandler.handleError(testErrorMsg, ArgumentError()); + errorHandler.handleError(ArgumentError(), testErrorMsg); errorHandler.stream.listen((lastControllerValue) { expect(lastControllerValue, isNotNull); expect(lastControllerValue.message, testErrorMsg); @@ -20,8 +20,8 @@ void main() { test('Handle_MultiplyErrors_Timings', () { errorHandler - ..handleError(testErrorMsg, ArgumentError('')) - ..handleError(testErrorMsg2, TypeError()); + ..handleError(ArgumentError(''), testErrorMsg) + ..handleError(TypeError(), testErrorMsg2); expect(errorHandler.history, isNotNull); expect(errorHandler.history, isNotEmpty); diff --git a/talker_error_handler/test/errorhandler_handle_exception_test.dart b/talker_error_handler/test/errorhandler_handle_exception_test.dart index e7b496f3..4917dc68 100644 --- a/talker_error_handler/test/errorhandler_handle_exception_test.dart +++ b/talker_error_handler/test/errorhandler_handle_exception_test.dart @@ -12,7 +12,7 @@ void main() { setUp(() => errorHandler = ErrorHandler()); test('Handle_Exception', () { - errorHandler.handleException(testExceptionMsg, DeferredLoadException('')); + errorHandler.handleException(DeferredLoadException(''), testExceptionMsg); errorHandler.stream.listen((lastControllerValue) { expect(lastControllerValue, isNotNull); expect(lastControllerValue.message, testExceptionMsg); @@ -25,8 +25,8 @@ void main() { test('Handle_MultiplyExceptions_Timings', () { errorHandler - ..handleException(testExceptionMsg, DeferredLoadException('')) - ..handleException(testExceptionMsg2, Exception('')); + ..handleException(DeferredLoadException(''), testExceptionMsg) + ..handleException(Exception(''), testExceptionMsg2); expect(errorHandler.history, isNotNull); expect(errorHandler.history, isNotEmpty); diff --git a/talker_error_handler/test/errorhandler_history_test.dart b/talker_error_handler/test/errorhandler_history_test.dart index ec479c0b..c9203704 100644 --- a/talker_error_handler/test/errorhandler_history_test.dart +++ b/talker_error_handler/test/errorhandler_history_test.dart @@ -27,8 +27,8 @@ void main() { ); errorHandler - ..handleException(testExceptionMsg, DeferredLoadException('')) - ..handleException(testExceptionMsg2, Exception('')); + ..handleException(DeferredLoadException(''), testExceptionMsg) + ..handleException(Exception(''), testExceptionMsg2); expect(errorHandler.history, isNotNull); expect(errorHandler.history, isNotEmpty); @@ -39,5 +39,5 @@ void main() { } void _handleException(ErrorHandler errorHandler, String testExceptionMsg) { - errorHandler.handleException(testExceptionMsg, Exception(testExceptionMsg)); + errorHandler.handleException(Exception(testExceptionMsg), testExceptionMsg); } From 3a0b5c952b9a8ede8f97e0a1c5c36be58fdea5fc Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 18:10:30 +0300 Subject: [PATCH 03/38] Fix talker data models --- .../talker_data/talker_data_interface.dart | 7 ++++++ .../src/models/talker_data/talker_error.dart | 12 +++++----- .../models/talker_data/talker_exception.dart | 10 ++++---- talker/lib/src/talker.dart | 24 ++++++++++--------- talker/pubspec.yaml | 4 ++-- 5 files changed, 33 insertions(+), 24 deletions(-) diff --git a/talker/lib/src/models/talker_data/talker_data_interface.dart b/talker/lib/src/models/talker_data/talker_data_interface.dart index c7293bf5..328080e2 100644 --- a/talker/lib/src/models/talker_data/talker_data_interface.dart +++ b/talker/lib/src/models/talker_data/talker_data_interface.dart @@ -56,4 +56,11 @@ extension GetTitle on TalkerDataInterface { } return '\n$additional'; } + + String get consoleMessage { + if (message == null) { + return ''; + } + return '$message'; + } } diff --git a/talker/lib/src/models/talker_data/talker_error.dart b/talker/lib/src/models/talker_data/talker_error.dart index 106fad0b..e91f0fc3 100644 --- a/talker/lib/src/models/talker_data/talker_error.dart +++ b/talker/lib/src/models/talker_data/talker_error.dart @@ -2,9 +2,9 @@ import 'package:talker/talker.dart'; class TalkerError implements TalkerDataInterface { TalkerError( - this.message, { + this.error, { + this.message, this.logLevel, - this.error, this.stackTrace, DateTime? time, }) { @@ -12,13 +12,13 @@ class TalkerError implements TalkerDataInterface { } @override - final String message; + final Error error; @override - final Exception? exception = null; + final String? message; @override - final Error? error; + final Exception? exception = null; @override final StackTrace? stackTrace; @@ -31,7 +31,7 @@ class TalkerError implements TalkerDataInterface { @override String generateTextMessage() { - final mes = '$titleText$message$consoleError\n$consoleStackTrace'; + final mes = '$titleText$consoleMessage$consoleError\n$consoleStackTrace'; final underline = ConsoleFormater.getUnderLine(mes); return mes + underline; } diff --git a/talker/lib/src/models/talker_data/talker_exception.dart b/talker/lib/src/models/talker_data/talker_exception.dart index 43d77276..c370522c 100644 --- a/talker/lib/src/models/talker_data/talker_exception.dart +++ b/talker/lib/src/models/talker_data/talker_exception.dart @@ -2,9 +2,9 @@ import 'package:talker/talker.dart'; class TalkerException implements TalkerDataInterface { TalkerException( - this.message, { + this.exception, { + this.message, this.logLevel, - this.exception, this.stackTrace, DateTime? time, }) { @@ -12,10 +12,10 @@ class TalkerException implements TalkerDataInterface { } @override - final String message; + final Exception exception; @override - final Exception? exception; + final String? message; @override final Error? error = null; @@ -31,7 +31,7 @@ class TalkerException implements TalkerDataInterface { @override String generateTextMessage() { - final mes = '$titleText$message$consoleException$consoleStackTrace'; + final mes = '$titleText$consoleMessage$consoleException$consoleStackTrace'; final underline = ConsoleFormater.getUnderLine(mes); return mes + underline; } diff --git a/talker/lib/src/talker.dart b/talker/lib/src/talker.dart index b08d7ca0..c6c09d25 100644 --- a/talker/lib/src/talker.dart +++ b/talker/lib/src/talker.dart @@ -19,21 +19,23 @@ class Talker implements TalkerInterface { late final _logger = TalkerLogger(); late final _errorHandler = ErrorHandler() - ..stream.listen((err) { + ..stream.listen((details) { TalkerDataInterface? data; - if (err.error != null) { + final err = details.error; + final exception = details.exception; + if (err != null) { data = TalkerError( - err.message, - error: err.error, - stackTrace: err.stackTrace, - logLevel: err.errorLevel?.loglevel ?? LogLevel.error, + err, + message: details.message, + stackTrace: details.stackTrace, + logLevel: details.errorLevel?.loglevel ?? LogLevel.error, ); - } else if (err.exception != null) { + } else if (exception != null) { data = TalkerException( - err.message, - exception: err.exception, - stackTrace: err.stackTrace, - logLevel: err.errorLevel?.loglevel ?? LogLevel.error, + exception, + message: details.message, + stackTrace: details.stackTrace, + logLevel: details.errorLevel?.loglevel ?? LogLevel.error, ); } diff --git a/talker/pubspec.yaml b/talker/pubspec.yaml index c4feeede..23a64aec 100644 --- a/talker/pubspec.yaml +++ b/talker/pubspec.yaml @@ -11,12 +11,12 @@ dependencies: talker_error_handler: git: url: https://github.com/Frezyx/talker - ref: master + ref: dev path: talker_error_handler/ talker_logger: git: url: https://github.com/Frezyx/talker - ref: master + ref: dev path: talker_logger/ intl: ^0.17.0 From dbc3d3f758656afa320a2da9bdce3a0fc4d7a32e Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 18:14:11 +0300 Subject: [PATCH 04/38] Sync talker delegation methods to error handler api --- .../lib/src/observers/observers_manager.dart | 2 +- talker/lib/src/observers/talker_observer.dart | 2 +- talker/lib/src/talker.dart | 29 ++++++++++--------- talker/lib/src/talker_interface.dart | 4 +-- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/talker/lib/src/observers/observers_manager.dart b/talker/lib/src/observers/observers_manager.dart index 715bca3f..76d7d56c 100644 --- a/talker/lib/src/observers/observers_manager.dart +++ b/talker/lib/src/observers/observers_manager.dart @@ -6,7 +6,7 @@ class TalkerObserversManager { TalkerObserversManager(this.observers); final List observers; - void onError(ErrorContainer container) { + void onError(ErrorDetails container) { for (final o in observers) { o.onError(container); } diff --git a/talker/lib/src/observers/talker_observer.dart b/talker/lib/src/observers/talker_observer.dart index 3087541c..986f826a 100644 --- a/talker/lib/src/observers/talker_observer.dart +++ b/talker/lib/src/observers/talker_observer.dart @@ -2,6 +2,6 @@ import 'package:talker/src/models/talker_data/talker_data.dart'; import 'package:talker_error_handler/talker_error_handler.dart'; abstract class TalkerObserver { - Function(ErrorContainer err) get onError; + Function(ErrorDetails err) get onError; Function(TalkerDataInterface data) get onLog; } diff --git a/talker/lib/src/talker.dart b/talker/lib/src/talker.dart index c6c09d25..a671810a 100644 --- a/talker/lib/src/talker.dart +++ b/talker/lib/src/talker.dart @@ -75,50 +75,51 @@ class Talker implements TalkerInterface { @override void handle( - String msg, [ - Object? exception, + Object exception, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]) { - final container = _errorHandler.handle( - msg, + final details = _errorHandler.handle( exception, + msg, stackTrace, errorLevel, ); - if (container != null) { - _observersManager?.onError(container); + if (details != null) { + _observersManager?.onError(details); } } @override void handleError( - String msg, [ - Error? error, + Error error, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]) { final errContainer = - _errorHandler.handleError(msg, error, stackTrace, errorLevel); + _errorHandler.handleError(error, msg, stackTrace, errorLevel); _observersManager?.onError(errContainer); } @override void handleException( - String msg, [ - Exception? exception, + Exception exception, [ + String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]) { final errContainer = - _errorHandler.handleException(msg, exception, stackTrace, errorLevel); + _errorHandler.handleException(exception, msg, stackTrace, errorLevel); _observersManager?.onError(errContainer); } @override void log( - String message, - LogLevel logLevel, { + String message, { + //TODO: add default for settings + LogLevel logLevel = LogLevel.debug, Map? additional, }) { final logData = TalkerLog( diff --git a/talker/lib/src/talker_interface.dart b/talker/lib/src/talker_interface.dart index 6b4dbc53..1948df40 100644 --- a/talker/lib/src/talker_interface.dart +++ b/talker/lib/src/talker_interface.dart @@ -17,14 +17,14 @@ abstract class TalkerInterface { ]); void handleError( - Error? error, [ + Error error, [ String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, ]); void handleException( - Exception? exception, [ + Exception exception, [ String? msg, StackTrace? stackTrace, ErrorLevel? errorLevel, From 0e65424035c6b90b2590bb2451f23639c75c73e5 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 18:15:12 +0300 Subject: [PATCH 05/38] Fix talker_flutter talker methods calling --- talker_flutter/example/lib/main.dart | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/talker_flutter/example/lib/main.dart b/talker_flutter/example/lib/main.dart index a581dcec..e3a1e38a 100644 --- a/talker_flutter/example/lib/main.dart +++ b/talker_flutter/example/lib/main.dart @@ -45,8 +45,8 @@ class _MyAppState extends State { children: [ MaterialButton( onPressed: () => Talker.instance.handleError( - 'dart argument error', ArgumentError('-6 is not positive number'), + 'dart argument error', ), color: Colors.black, child: const Text( @@ -58,8 +58,9 @@ class _MyAppState extends State { ), MaterialButton( onPressed: () => Talker.instance.handleException( - 'Http service is not working', - Exception('Not connected')), + Exception('Not connected'), + 'Http service is not working', + ), color: Colors.black, child: const Text( 'Exception', @@ -71,7 +72,7 @@ class _MyAppState extends State { MaterialButton( onPressed: () => Talker.instance.log( 'Service send good request', - LogLevel.fine, + logLevel: LogLevel.fine, ), color: Colors.black, child: const Text( @@ -84,7 +85,7 @@ class _MyAppState extends State { MaterialButton( onPressed: () => Talker.instance.log( 'Renew token from expire date', - LogLevel.info, + logLevel: LogLevel.info, ), color: Colors.black, child: const Text( @@ -97,7 +98,7 @@ class _MyAppState extends State { MaterialButton( onPressed: () => Talker.instance.log( 'Cache images working slowly on this platform', - LogLevel.warning, + logLevel: LogLevel.warning, ), color: Colors.black, child: const Text( @@ -110,7 +111,7 @@ class _MyAppState extends State { MaterialButton( onPressed: () => Talker.instance.log( 'Server exception', - LogLevel.critical, + logLevel: LogLevel.critical, additional: { "timestamp": 1510417124782, "status": 500, From add25a3fc327a1793e214a04754ddf119c94fb4c Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 18:15:49 +0300 Subject: [PATCH 06/38] Fix talker example --- talker/example/talker_example.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/talker/example/talker_example.dart b/talker/example/talker_example.dart index 9ce1efb3..c3da74e9 100644 --- a/talker/example/talker_example.dart +++ b/talker/example/talker_example.dart @@ -6,18 +6,18 @@ Future main() async { try { throw Exception('Test service exception'); } catch (e, st) { - Talker.instance.handle('Working with string error', e, st); + Talker.instance.handle(e, 'Working with string error', st); } try { throw Exception('Service can`t get test data'); } on Exception catch (e, st) { - Talker.instance.handleException('Working with strings exception', e, st); + Talker.instance.handleException(e, 'Working with strings exception', st); } Talker.instance.log( 'Big app crashing exception in Some service', - LogLevel.critical, + logLevel: LogLevel.critical, additional: { "timestamp": 1510417124782, "status": 500, From 5eb6782a853dd337be6a5fe67565642e2379fbc2 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 18:19:18 +0300 Subject: [PATCH 07/38] Add observer todo --- talker/lib/src/observers/talker_observer.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/talker/lib/src/observers/talker_observer.dart b/talker/lib/src/observers/talker_observer.dart index 986f826a..b7064e4d 100644 --- a/talker/lib/src/observers/talker_observer.dart +++ b/talker/lib/src/observers/talker_observer.dart @@ -1,6 +1,7 @@ import 'package:talker/src/models/talker_data/talker_data.dart'; import 'package:talker_error_handler/talker_error_handler.dart'; +//TODO: make it real class abstract class TalkerObserver { Function(ErrorDetails err) get onError; Function(TalkerDataInterface data) get onLog; From c485d4681b089135847fa5e3dc40bf3f0f38e947 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 20:10:30 +0300 Subject: [PATCH 08/38] Fix flutter talker deps --- talker_flutter/example/pubspec.lock | 26 ++++++++++++++++---------- talker_flutter/pubspec.yaml | 7 +++++-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/talker_flutter/example/pubspec.lock b/talker_flutter/example/pubspec.lock index 1f030d7a..97512621 100644 --- a/talker_flutter/example/pubspec.lock +++ b/talker_flutter/example/pubspec.lock @@ -152,16 +152,20 @@ packages: talker: dependency: transitive description: - path: "../../talker" - relative: true - source: path - version: "1.0.0" + path: talker + ref: dev + resolved-ref: "5eb6782a853dd337be6a5fe67565642e2379fbc2" + url: "https://github.com/Frezyx/talker" + source: git + version: "0.1.0" talker_error_handler: dependency: transitive description: - path: "../../talker_error_handler" - relative: true - source: path + path: talker_error_handler + ref: dev + resolved-ref: "5eb6782a853dd337be6a5fe67565642e2379fbc2" + url: "https://github.com/Frezyx/talker" + source: git version: "0.1.0" talker_flutter: dependency: "direct main" @@ -173,9 +177,11 @@ packages: talker_logger: dependency: transitive description: - path: "../../talker_logger" - relative: true - source: path + path: talker_logger + ref: dev + resolved-ref: "5eb6782a853dd337be6a5fe67565642e2379fbc2" + url: "https://github.com/Frezyx/talker" + source: git version: "0.1.0" term_glyph: dependency: transitive diff --git a/talker_flutter/pubspec.yaml b/talker_flutter/pubspec.yaml index 9c87a777..6def2ea0 100644 --- a/talker_flutter/pubspec.yaml +++ b/talker_flutter/pubspec.yaml @@ -10,9 +10,12 @@ environment: dependencies: flutter: sdk: flutter + talker: - path: - ../talker + git: + url: https://github.com/Frezyx/talker + ref: dev + path: talker/ dev_dependencies: flutter_test: From ac8416a757fe4413668b01c36acaf9eef9b15c36 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 20:12:44 +0300 Subject: [PATCH 09/38] Rename date fmt class --- talker/lib/src/models/talker_data/talker_data_interface.dart | 2 +- talker/lib/src/utils/formaters/date_time_formater.dart | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/talker/lib/src/models/talker_data/talker_data_interface.dart b/talker/lib/src/models/talker_data/talker_data_interface.dart index 328080e2..c96dab81 100644 --- a/talker/lib/src/models/talker_data/talker_data_interface.dart +++ b/talker/lib/src/models/talker_data/talker_data_interface.dart @@ -26,7 +26,7 @@ extension GetTitle on TalkerDataInterface { title = logLevel.title; break; } - return '[$title]' + ' | ${DateTimeFormater(time).timeAndSeconds} | '; + return '[$title]' + ' | ${TalkerDateTimeFormater(time).timeAndSeconds} | '; } String get consoleStackTrace { diff --git a/talker/lib/src/utils/formaters/date_time_formater.dart b/talker/lib/src/utils/formaters/date_time_formater.dart index 46aaca69..5358cfa6 100644 --- a/talker/lib/src/utils/formaters/date_time_formater.dart +++ b/talker/lib/src/utils/formaters/date_time_formater.dart @@ -1,7 +1,7 @@ import 'package:intl/intl.dart'; -class DateTimeFormater { - const DateTimeFormater(this.date); +class TalkerDateTimeFormater { + const TalkerDateTimeFormater(this.date); final DateTime date; String get timeAndSeconds { From b29c4431796395b93f5a32fb8da33de22b5d9bbe Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 20:50:43 +0300 Subject: [PATCH 10/38] Fix logs formating --- .../src/models/talker_data/talker_error.dart | 3 +-- .../models/talker_data/talker_exception.dart | 3 +-- .../src/models/talker_data/talker_log.dart | 3 +-- talker/lib/src/settings/talker_settings.dart | 2 +- talker/pubspec.yaml | 20 +++++++++------- talker_flutter/example/lib/main.dart | 4 +++- talker_flutter/example/pubspec.lock | 24 +++++++------------ talker_flutter/pubspec.yaml | 10 ++++---- talker_logger/lib/src/talker_logger_base.dart | 5 +++- .../lib/src/utils/console_formater.dart | 6 +++-- .../utils/formater/base_logger_formater.dart | 5 ++-- .../src/utils/formater/logger_formater.dart | 2 +- 12 files changed, 46 insertions(+), 41 deletions(-) diff --git a/talker/lib/src/models/talker_data/talker_error.dart b/talker/lib/src/models/talker_data/talker_error.dart index e91f0fc3..c62678f7 100644 --- a/talker/lib/src/models/talker_data/talker_error.dart +++ b/talker/lib/src/models/talker_data/talker_error.dart @@ -32,8 +32,7 @@ class TalkerError implements TalkerDataInterface { @override String generateTextMessage() { final mes = '$titleText$consoleMessage$consoleError\n$consoleStackTrace'; - final underline = ConsoleFormater.getUnderLine(mes); - return mes + underline; + return ConsoleFormater.addUnderline(mes); } @override diff --git a/talker/lib/src/models/talker_data/talker_exception.dart b/talker/lib/src/models/talker_data/talker_exception.dart index c370522c..9abba70a 100644 --- a/talker/lib/src/models/talker_data/talker_exception.dart +++ b/talker/lib/src/models/talker_data/talker_exception.dart @@ -32,8 +32,7 @@ class TalkerException implements TalkerDataInterface { @override String generateTextMessage() { final mes = '$titleText$consoleMessage$consoleException$consoleStackTrace'; - final underline = ConsoleFormater.getUnderLine(mes); - return mes + underline; + return ConsoleFormater.addUnderline(mes); } @override diff --git a/talker/lib/src/models/talker_data/talker_log.dart b/talker/lib/src/models/talker_data/talker_log.dart index a8332ddc..4aec85f5 100644 --- a/talker/lib/src/models/talker_data/talker_log.dart +++ b/talker/lib/src/models/talker_data/talker_log.dart @@ -34,8 +34,7 @@ class TalkerLog implements TalkerDataInterface { @override String generateTextMessage() { final mes = '$titleText$message$consoleAditional'; - final underline = ConsoleFormater.getUnderLine(mes); - return mes + underline; + return ConsoleFormater.addUnderline(mes); } @override diff --git a/talker/lib/src/settings/talker_settings.dart b/talker/lib/src/settings/talker_settings.dart index 753f1d13..4793673d 100644 --- a/talker/lib/src/settings/talker_settings.dart +++ b/talker/lib/src/settings/talker_settings.dart @@ -4,7 +4,7 @@ class TalkerSettings { const TalkerSettings({ this.useHistory = true, this.maxHistoryItems = 200, - this.writeToFile = true, + this.writeToFile = false, }); final bool useHistory; diff --git a/talker/pubspec.yaml b/talker/pubspec.yaml index 23a64aec..cbcb511d 100644 --- a/talker/pubspec.yaml +++ b/talker/pubspec.yaml @@ -9,15 +9,19 @@ environment: dependencies: talker_error_handler: - git: - url: https://github.com/Frezyx/talker - ref: dev - path: talker_error_handler/ + path: + ../talker_error_handler + # git: + # url: https://github.com/Frezyx/talker + # ref: dev + # path: talker_error_handler/ talker_logger: - git: - url: https://github.com/Frezyx/talker - ref: dev - path: talker_logger/ + path: + ../talker_logger + # git: + # url: https://github.com/Frezyx/talker + # ref: dev + # path: talker_logger/ intl: ^0.17.0 dev_dependencies: diff --git a/talker_flutter/example/lib/main.dart b/talker_flutter/example/lib/main.dart index e3a1e38a..6effe9be 100644 --- a/talker_flutter/example/lib/main.dart +++ b/talker_flutter/example/lib/main.dart @@ -15,7 +15,9 @@ class MyApp extends StatefulWidget { class _MyAppState extends State { @override void initState() { - Talker.instance.configure(); + Talker.instance.configure( + settings: const TalkerSettings(writeToFile: false), + ); super.initState(); } diff --git a/talker_flutter/example/pubspec.lock b/talker_flutter/example/pubspec.lock index 97512621..ba06904f 100644 --- a/talker_flutter/example/pubspec.lock +++ b/talker_flutter/example/pubspec.lock @@ -152,20 +152,16 @@ packages: talker: dependency: transitive description: - path: talker - ref: dev - resolved-ref: "5eb6782a853dd337be6a5fe67565642e2379fbc2" - url: "https://github.com/Frezyx/talker" - source: git + path: "../../talker" + relative: true + source: path version: "0.1.0" talker_error_handler: dependency: transitive description: - path: talker_error_handler - ref: dev - resolved-ref: "5eb6782a853dd337be6a5fe67565642e2379fbc2" - url: "https://github.com/Frezyx/talker" - source: git + path: "../../talker_error_handler" + relative: true + source: path version: "0.1.0" talker_flutter: dependency: "direct main" @@ -177,11 +173,9 @@ packages: talker_logger: dependency: transitive description: - path: talker_logger - ref: dev - resolved-ref: "5eb6782a853dd337be6a5fe67565642e2379fbc2" - url: "https://github.com/Frezyx/talker" - source: git + path: "../../talker_logger" + relative: true + source: path version: "0.1.0" term_glyph: dependency: transitive diff --git a/talker_flutter/pubspec.yaml b/talker_flutter/pubspec.yaml index 6def2ea0..b5fbbce5 100644 --- a/talker_flutter/pubspec.yaml +++ b/talker_flutter/pubspec.yaml @@ -12,10 +12,12 @@ dependencies: sdk: flutter talker: - git: - url: https://github.com/Frezyx/talker - ref: dev - path: talker/ + path: + ../talker + # git: + # url: https://github.com/Frezyx/talker + # ref: dev + # path: talker/ dev_dependencies: flutter_test: diff --git a/talker_logger/lib/src/talker_logger_base.dart b/talker_logger/lib/src/talker_logger_base.dart index 147d3f97..f87a023d 100644 --- a/talker_logger/lib/src/talker_logger_base.dart +++ b/talker_logger/lib/src/talker_logger_base.dart @@ -16,8 +16,11 @@ class TalkerLogger { void log(String msg, {LogLevel logLevel = LogLevel.debug}) { var pen = settings.colors[logLevel]; pen = pen ?? logLevel.consoleColor; + if (_filter.shouldLog(msg, logLevel)) { - consolePrint(formater.fmt(pen.write(msg), logLevel)); + consolePrint( + formater.fmt(msg, logLevel, pen), + ); } } diff --git a/talker_logger/lib/src/utils/console_formater.dart b/talker_logger/lib/src/utils/console_formater.dart index 04fec3e8..72d2b21a 100644 --- a/talker_logger/lib/src/utils/console_formater.dart +++ b/talker_logger/lib/src/utils/console_formater.dart @@ -1,11 +1,13 @@ abstract class ConsoleFormater { ConsoleFormater._(); - static String getUnderLine(String mes) { + static String addUnderline(String mes) { final parts = mes.split('\n'); + final haveEndSep = parts.last.isEmpty; parts.sort((a, b) => a.length.compareTo(b.length)); final lineLen = parts.last.length; - return haveEndSep ? '_' * lineLen : '\n${'_' * lineLen}'; + + return mes + (haveEndSep ? '_' * lineLen : '\n${'_' * lineLen}'); } } diff --git a/talker_logger/lib/src/utils/formater/base_logger_formater.dart b/talker_logger/lib/src/utils/formater/base_logger_formater.dart index cafc8a97..68474e76 100644 --- a/talker_logger/lib/src/utils/formater/base_logger_formater.dart +++ b/talker_logger/lib/src/utils/formater/base_logger_formater.dart @@ -3,7 +3,8 @@ import 'package:talker_logger/talker_logger.dart'; class BaseLoggerFormater implements LoggerFormater { const BaseLoggerFormater(); @override - String fmt(String msg, LogLevel level) { - return msg; + String fmt(String msg, LogLevel level, AnsiPen pen) { + final parts = msg.split('\n'); + return parts.map((e) => pen.write(e)).join('\n'); } } diff --git a/talker_logger/lib/src/utils/formater/logger_formater.dart b/talker_logger/lib/src/utils/formater/logger_formater.dart index 7f90945c..0e9ae855 100644 --- a/talker_logger/lib/src/utils/formater/logger_formater.dart +++ b/talker_logger/lib/src/utils/formater/logger_formater.dart @@ -1,5 +1,5 @@ import 'package:talker_logger/talker_logger.dart'; abstract class LoggerFormater { - String fmt(String msg, LogLevel level); + String fmt(String msg, LogLevel level, AnsiPen pen); } From 92a60b7058fd1ee05f1b6e47b615aa4448051741 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 20:57:14 +0300 Subject: [PATCH 11/38] Update talker flutter UI --- .../talker_data/talker_data_interface.dart | 14 ++++++----- .../src/models/talker_data/talker_error.dart | 2 +- .../models/talker_data/talker_exception.dart | 2 +- .../src/models/talker_data/talker_log.dart | 2 +- .../src/widgets/cards/talker_data_card.dart | 24 ++++++++++++++++--- 5 files changed, 32 insertions(+), 12 deletions(-) diff --git a/talker/lib/src/models/talker_data/talker_data_interface.dart b/talker/lib/src/models/talker_data/talker_data_interface.dart index c96dab81..089b9a41 100644 --- a/talker/lib/src/models/talker_data/talker_data_interface.dart +++ b/talker/lib/src/models/talker_data/talker_data_interface.dart @@ -26,41 +26,43 @@ extension GetTitle on TalkerDataInterface { title = logLevel.title; break; } - return '[$title]' + ' | ${TalkerDateTimeFormater(time).timeAndSeconds} | '; + return '[$title]' + ' | $displayTime | '; } - String get consoleStackTrace { + String get displayStackTrace { if (stackTrace == null) { return ''; } return '\nStackTrace:\n${stackTrace ?? ''}'; } - String get consoleException { + String get displayException { if (exception == null) { return ''; } return '\nException: $exception'; } - String get consoleError { + String get displayError { if (error == null) { return ''; } return '\nError: $error'; } - String get consoleAditional { + String get displayAditional { if (additional == null) { return ''; } return '\n$additional'; } - String get consoleMessage { + String get displayMessage { if (message == null) { return ''; } return '$message'; } + + String get displayTime => TalkerDateTimeFormater(time).timeAndSeconds; } diff --git a/talker/lib/src/models/talker_data/talker_error.dart b/talker/lib/src/models/talker_data/talker_error.dart index c62678f7..34f90193 100644 --- a/talker/lib/src/models/talker_data/talker_error.dart +++ b/talker/lib/src/models/talker_data/talker_error.dart @@ -31,7 +31,7 @@ class TalkerError implements TalkerDataInterface { @override String generateTextMessage() { - final mes = '$titleText$consoleMessage$consoleError\n$consoleStackTrace'; + final mes = '$titleText$displayMessage$displayError\n$displayStackTrace'; return ConsoleFormater.addUnderline(mes); } diff --git a/talker/lib/src/models/talker_data/talker_exception.dart b/talker/lib/src/models/talker_data/talker_exception.dart index 9abba70a..4ab0d9ba 100644 --- a/talker/lib/src/models/talker_data/talker_exception.dart +++ b/talker/lib/src/models/talker_data/talker_exception.dart @@ -31,7 +31,7 @@ class TalkerException implements TalkerDataInterface { @override String generateTextMessage() { - final mes = '$titleText$consoleMessage$consoleException$consoleStackTrace'; + final mes = '$titleText$displayMessage$displayException$displayStackTrace'; return ConsoleFormater.addUnderline(mes); } diff --git a/talker/lib/src/models/talker_data/talker_log.dart b/talker/lib/src/models/talker_data/talker_log.dart index 4aec85f5..a3d93c19 100644 --- a/talker/lib/src/models/talker_data/talker_log.dart +++ b/talker/lib/src/models/talker_data/talker_log.dart @@ -33,7 +33,7 @@ class TalkerLog implements TalkerDataInterface { @override String generateTextMessage() { - final mes = '$titleText$message$consoleAditional'; + final mes = '$titleText$message$displayAditional'; return ConsoleFormater.addUnderline(mes); } diff --git a/talker_flutter/lib/src/widgets/cards/talker_data_card.dart b/talker_flutter/lib/src/widgets/cards/talker_data_card.dart index 76b85381..8ba5fb8b 100644 --- a/talker_flutter/lib/src/widgets/cards/talker_data_card.dart +++ b/talker_flutter/lib/src/widgets/cards/talker_data_card.dart @@ -45,7 +45,7 @@ class TalkerDataCard extends StatelessWidget { ), children: [ TextSpan( - text: data.message ?? '', + text: data.displayMessage, style: const TextStyle( fontWeight: FontWeight.normal, ), @@ -62,7 +62,7 @@ class TalkerDataCard extends StatelessWidget { ), children: [ TextSpan( - text: DateTime.now().toString(), + text: data.displayTime, style: const TextStyle( fontWeight: FontWeight.normal, ), @@ -70,6 +70,24 @@ class TalkerDataCard extends StatelessWidget { ], ), ), + if (data.stackTrace != null) + RichText( + text: TextSpan( + text: 'StackTrace ', + style: TextStyle( + color: data.logLevel.color, + fontWeight: FontWeight.bold, + ), + children: [ + TextSpan( + text: data.displayStackTrace, + style: const TextStyle( + fontWeight: FontWeight.normal, + ), + ), + ], + ), + ), if (data.additional != null) RichText( text: TextSpan( @@ -80,7 +98,7 @@ class TalkerDataCard extends StatelessWidget { ), children: [ TextSpan( - text: data.additional!.toString(), + text: data.displayAditional, style: const TextStyle( fontWeight: FontWeight.normal, ), From f831cbea7542fe0cff98b92eb177ddd9392a8120 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 20:58:09 +0300 Subject: [PATCH 12/38] Fix deps to git --- talker/pubspec.yaml | 24 ++++++++++++------------ talker_flutter/pubspec.yaml | 12 ++++++------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/talker/pubspec.yaml b/talker/pubspec.yaml index cbcb511d..7c3e2f35 100644 --- a/talker/pubspec.yaml +++ b/talker/pubspec.yaml @@ -9,19 +9,19 @@ environment: dependencies: talker_error_handler: - path: - ../talker_error_handler - # git: - # url: https://github.com/Frezyx/talker - # ref: dev - # path: talker_error_handler/ + # path: + # ../talker_error_handler + git: + url: https://github.com/Frezyx/talker + ref: dev + path: talker_error_handler/ talker_logger: - path: - ../talker_logger - # git: - # url: https://github.com/Frezyx/talker - # ref: dev - # path: talker_logger/ + # path: + # ../talker_logger + git: + url: https://github.com/Frezyx/talker + ref: dev + path: talker_logger/ intl: ^0.17.0 dev_dependencies: diff --git a/talker_flutter/pubspec.yaml b/talker_flutter/pubspec.yaml index b5fbbce5..b0d38fe6 100644 --- a/talker_flutter/pubspec.yaml +++ b/talker_flutter/pubspec.yaml @@ -12,12 +12,12 @@ dependencies: sdk: flutter talker: - path: - ../talker - # git: - # url: https://github.com/Frezyx/talker - # ref: dev - # path: talker/ + # path: + # ../talker + git: + url: https://github.com/Frezyx/talker + ref: dev + path: talker/ dev_dependencies: flutter_test: From f2522a31f737bf695d4408204dc55d11b5d67af3 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 21:02:01 +0300 Subject: [PATCH 13/38] load lock --- talker_flutter/example/pubspec.lock | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/talker_flutter/example/pubspec.lock b/talker_flutter/example/pubspec.lock index ba06904f..33636a2f 100644 --- a/talker_flutter/example/pubspec.lock +++ b/talker_flutter/example/pubspec.lock @@ -152,16 +152,20 @@ packages: talker: dependency: transitive description: - path: "../../talker" - relative: true - source: path + path: talker + ref: dev + resolved-ref: f831cbea7542fe0cff98b92eb177ddd9392a8120 + url: "https://github.com/Frezyx/talker" + source: git version: "0.1.0" talker_error_handler: dependency: transitive description: - path: "../../talker_error_handler" - relative: true - source: path + path: talker_error_handler + ref: dev + resolved-ref: f831cbea7542fe0cff98b92eb177ddd9392a8120 + url: "https://github.com/Frezyx/talker" + source: git version: "0.1.0" talker_flutter: dependency: "direct main" @@ -173,9 +177,11 @@ packages: talker_logger: dependency: transitive description: - path: "../../talker_logger" - relative: true - source: path + path: talker_logger + ref: dev + resolved-ref: f831cbea7542fe0cff98b92eb177ddd9392a8120 + url: "https://github.com/Frezyx/talker" + source: git version: "0.1.0" term_glyph: dependency: transitive From c41fb4fe8d8cd89091f10bb02197376411003288 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 21:15:32 +0300 Subject: [PATCH 14/38] Comment file logs --- talker/lib/src/talker.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/talker/lib/src/talker.dart b/talker/lib/src/talker.dart index a671810a..e7cf62c4 100644 --- a/talker/lib/src/talker.dart +++ b/talker/lib/src/talker.dart @@ -145,14 +145,15 @@ class Talker implements TalkerInterface { void _handleForOutputs(TalkerDataInterface data) { _writeToHistory(data); - _writeToFile(data); + // _writeToFile(data); } - void _writeToFile(TalkerDataInterface data) { - if (_settings.writeToFile) { - _fileManager.writeToLogFile(data.generateTextMessage()); - } - } + //TODO: recreate file manager logic + // void _writeToFile(TalkerDataInterface data) { + // if (_settings.writeToFile) { + // _fileManager.writeToLogFile(data.generateTextMessage()); + // } + // } void _writeToHistory(TalkerDataInterface data) { if (_settings.useHistory) { From de21f356d88c10ae975e1642b1b2b6c74befb11f Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 21:22:32 +0300 Subject: [PATCH 15/38] Full comment file manager --- talker/lib/src/talker.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/talker/lib/src/talker.dart b/talker/lib/src/talker.dart index e7cf62c4..7fc745df 100644 --- a/talker/lib/src/talker.dart +++ b/talker/lib/src/talker.dart @@ -14,7 +14,7 @@ class Talker implements TalkerInterface { TalkerObserversManager? _observersManager; late TalkerSettings _settings; - final _fileManager = FileManager(); + // final _fileManager = FileManager(); final _history = []; late final _logger = TalkerLogger(); From a347ff057c930024f806c2d099b76a9f31b7883a Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 21:24:21 +0300 Subject: [PATCH 16/38] fix deps --- talker/pubspec.yaml | 4 ++-- talker_flutter/example/pubspec.lock | 4 ++-- talker_flutter/pubspec.yaml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/talker/pubspec.yaml b/talker/pubspec.yaml index 7c3e2f35..f3bf78f6 100644 --- a/talker/pubspec.yaml +++ b/talker/pubspec.yaml @@ -13,14 +13,14 @@ dependencies: # ../talker_error_handler git: url: https://github.com/Frezyx/talker - ref: dev + ref: testing path: talker_error_handler/ talker_logger: # path: # ../talker_logger git: url: https://github.com/Frezyx/talker - ref: dev + ref: testing path: talker_logger/ intl: ^0.17.0 diff --git a/talker_flutter/example/pubspec.lock b/talker_flutter/example/pubspec.lock index 33636a2f..4a89b06b 100644 --- a/talker_flutter/example/pubspec.lock +++ b/talker_flutter/example/pubspec.lock @@ -153,8 +153,8 @@ packages: dependency: transitive description: path: talker - ref: dev - resolved-ref: f831cbea7542fe0cff98b92eb177ddd9392a8120 + ref: testing + resolved-ref: de21f356d88c10ae975e1642b1b2b6c74befb11f url: "https://github.com/Frezyx/talker" source: git version: "0.1.0" diff --git a/talker_flutter/pubspec.yaml b/talker_flutter/pubspec.yaml index b0d38fe6..ccd34452 100644 --- a/talker_flutter/pubspec.yaml +++ b/talker_flutter/pubspec.yaml @@ -16,7 +16,7 @@ dependencies: # ../talker git: url: https://github.com/Frezyx/talker - ref: dev + ref: testing path: talker/ dev_dependencies: From 3f78d259ddf990abbc31384128b070167f838fd7 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Wed, 5 Jan 2022 21:41:56 +0300 Subject: [PATCH 17/38] Fix deps paths --- talker/pubspec.yaml | 24 ++++++++++++------------ talker_flutter/example/pubspec.lock | 24 +++++++++--------------- talker_flutter/pubspec.yaml | 12 ++++++------ 3 files changed, 27 insertions(+), 33 deletions(-) diff --git a/talker/pubspec.yaml b/talker/pubspec.yaml index f3bf78f6..3f4dd543 100644 --- a/talker/pubspec.yaml +++ b/talker/pubspec.yaml @@ -9,19 +9,19 @@ environment: dependencies: talker_error_handler: - # path: - # ../talker_error_handler - git: - url: https://github.com/Frezyx/talker - ref: testing - path: talker_error_handler/ + path: + ../talker_error_handler + # git: + # url: https://github.com/Frezyx/talker + # ref: testing + # path: talker_error_handler/ talker_logger: - # path: - # ../talker_logger - git: - url: https://github.com/Frezyx/talker - ref: testing - path: talker_logger/ + path: + ../talker_logger + # git: + # url: https://github.com/Frezyx/talker + # ref: testing + # path: talker_logger/ intl: ^0.17.0 dev_dependencies: diff --git a/talker_flutter/example/pubspec.lock b/talker_flutter/example/pubspec.lock index 4a89b06b..ba06904f 100644 --- a/talker_flutter/example/pubspec.lock +++ b/talker_flutter/example/pubspec.lock @@ -152,20 +152,16 @@ packages: talker: dependency: transitive description: - path: talker - ref: testing - resolved-ref: de21f356d88c10ae975e1642b1b2b6c74befb11f - url: "https://github.com/Frezyx/talker" - source: git + path: "../../talker" + relative: true + source: path version: "0.1.0" talker_error_handler: dependency: transitive description: - path: talker_error_handler - ref: dev - resolved-ref: f831cbea7542fe0cff98b92eb177ddd9392a8120 - url: "https://github.com/Frezyx/talker" - source: git + path: "../../talker_error_handler" + relative: true + source: path version: "0.1.0" talker_flutter: dependency: "direct main" @@ -177,11 +173,9 @@ packages: talker_logger: dependency: transitive description: - path: talker_logger - ref: dev - resolved-ref: f831cbea7542fe0cff98b92eb177ddd9392a8120 - url: "https://github.com/Frezyx/talker" - source: git + path: "../../talker_logger" + relative: true + source: path version: "0.1.0" term_glyph: dependency: transitive diff --git a/talker_flutter/pubspec.yaml b/talker_flutter/pubspec.yaml index ccd34452..9833a5e8 100644 --- a/talker_flutter/pubspec.yaml +++ b/talker_flutter/pubspec.yaml @@ -12,12 +12,12 @@ dependencies: sdk: flutter talker: - # path: - # ../talker - git: - url: https://github.com/Frezyx/talker - ref: testing - path: talker/ + path: + ../talker + # git: + # url: https://github.com/Frezyx/talker + # ref: testing + # path: talker/ dev_dependencies: flutter_test: From 0ee8a7965a89808f79b41b5750e4e1249d0ea46b Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 13:54:05 +0300 Subject: [PATCH 18/38] Fix height of Container --- talker_flutter/example/lib/main.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/talker_flutter/example/lib/main.dart b/talker_flutter/example/lib/main.dart index 6effe9be..27ec2c96 100644 --- a/talker_flutter/example/lib/main.dart +++ b/talker_flutter/example/lib/main.dart @@ -37,7 +37,7 @@ class _MyAppState extends State { Align( alignment: Alignment.bottomCenter, child: Container( - height: 100, + height: 120, width: 600, color: Colors.white, padding: const EdgeInsets.all(10), From fb4438fb18367e58a0c1433625283858f8f362f9 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 14:39:12 +0300 Subject: [PATCH 19/38] Add filter tests --- talker_flutter/example/test/widget_test.dart | 48 +++++++++---------- .../example/talker_logger_example.dart | 2 +- .../src/settings/talker_logger_settings.dart | 4 +- talker_logger/lib/src/talker_logger_base.dart | 2 +- .../test/talker_logger_core_test.dart | 15 ------ talker_logger/test/talker_logger_test.dart | 36 ++++++++++++++ 6 files changed, 64 insertions(+), 43 deletions(-) delete mode 100644 talker_logger/test/talker_logger_core_test.dart create mode 100644 talker_logger/test/talker_logger_test.dart diff --git a/talker_flutter/example/test/widget_test.dart b/talker_flutter/example/test/widget_test.dart index a19dabb0..4bc62c98 100644 --- a/talker_flutter/example/test/widget_test.dart +++ b/talker_flutter/example/test/widget_test.dart @@ -1,30 +1,30 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. +// // This is a basic Flutter widget test. +// // +// // To perform an interaction with a widget in your test, use the WidgetTester +// // utility that Flutter provides. For example, you can send tap and scroll +// // gestures. You can also use WidgetTester to find child widgets in the widget +// // tree, read text, and verify that the values of widget properties are correct. -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_test/flutter_test.dart'; -import 'package:example/main.dart'; +// import 'package:example/main.dart'; -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const MyApp()); +// void main() { +// testWidgets('Counter increments smoke test', (WidgetTester tester) async { +// // Build our app and trigger a frame. +// await tester.pumpWidget(const MyApp()); - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); +// // Verify that our counter starts at 0. +// expect(find.text('0'), findsOneWidget); +// expect(find.text('1'), findsNothing); - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); +// // Tap the '+' icon and trigger a frame. +// await tester.tap(find.byIcon(Icons.add)); +// await tester.pump(); - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} +// // Verify that our counter has incremented. +// expect(find.text('0'), findsNothing); +// expect(find.text('1'), findsOneWidget); +// }); +// } diff --git a/talker_logger/example/talker_logger_example.dart b/talker_logger/example/talker_logger_example.dart index 0e71dd50..780f3941 100644 --- a/talker_logger/example/talker_logger_example.dart +++ b/talker_logger/example/talker_logger_example.dart @@ -3,7 +3,7 @@ import 'package:talker_logger/talker_logger.dart'; void main() { final logger = TalkerLogger( settings: const TalkerLoggerSettings( - logLevel: LogLevel.info, + level: LogLevel.info, ), ); diff --git a/talker_logger/lib/src/settings/talker_logger_settings.dart b/talker_logger/lib/src/settings/talker_logger_settings.dart index f4c9f071..d33f99b1 100644 --- a/talker_logger/lib/src/settings/talker_logger_settings.dart +++ b/talker_logger/lib/src/settings/talker_logger_settings.dart @@ -5,9 +5,9 @@ const kDefaultLoggerSettings = TalkerLoggerSettings(); class TalkerLoggerSettings { const TalkerLoggerSettings({ this.colors = const {}, - this.logLevel = LogLevel.good, + this.level = LogLevel.good, }); final Map colors; - final LogLevel logLevel; + final LogLevel level; } diff --git a/talker_logger/lib/src/talker_logger_base.dart b/talker_logger/lib/src/talker_logger_base.dart index f87a023d..4cbc74ed 100644 --- a/talker_logger/lib/src/talker_logger_base.dart +++ b/talker_logger/lib/src/talker_logger_base.dart @@ -6,7 +6,7 @@ class TalkerLogger { TalkerLoggerFilter? filter, this.formater = const BaseLoggerFormater(), }) { - _filter = filter ?? BaseTalkerLoggerFilter(settings.logLevel); + _filter = filter ?? BaseTalkerLoggerFilter(settings.level); } final TalkerLoggerSettings settings; diff --git a/talker_logger/test/talker_logger_core_test.dart b/talker_logger/test/talker_logger_core_test.dart deleted file mode 100644 index c2c62e36..00000000 --- a/talker_logger/test/talker_logger_core_test.dart +++ /dev/null @@ -1,15 +0,0 @@ -import 'package:test/test.dart'; - -void main() { - group('A group of tests', () { - // final awesome = Awesome(); - - setUp(() { - // Additional setup goes here. - }); - - test('First Test', () { - // expect(awesome.isAwesome, isTrue); - }); - }); -} diff --git a/talker_logger/test/talker_logger_test.dart b/talker_logger/test/talker_logger_test.dart new file mode 100644 index 00000000..adc9e29b --- /dev/null +++ b/talker_logger/test/talker_logger_test.dart @@ -0,0 +1,36 @@ +import 'package:talker_logger/talker_logger.dart'; +import 'package:test/test.dart'; + +void main() { + group('BaseTalkerLoggerFilter', () { + group('shouldLog', () { + for (final level in LogLevel.values) { + _testShouldLog(level); + } + }); + }); +} + +void _testShouldLog(LogLevel level) { + group(level.toString(), () { + final currIndex = logLevelPriorityList.indexOf(level); + final acceptForLogLevels = logLevelPriorityList.getRange( + 0, + currIndex, + ); + + for (final acceptedLevel in acceptForLogLevels) { + _testCompareLevels(level, acceptedLevel); + } + }); +} + +void _testCompareLevels(LogLevel level, LogLevel acceptedLevel) { + test('Lvl: $level, Accepted Lvl: $acceptedLevel', () { + final filter = _getFilter(level); + final shouldLog = filter.shouldLog(acceptedLevel.toString(), acceptedLevel); + expect(shouldLog, isTrue); + }); +} + +TalkerLoggerFilter _getFilter(LogLevel level) => BaseTalkerLoggerFilter(level); From d4373cacefa0ba1fd95e517268da5db0530c1b80 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 14:52:11 +0300 Subject: [PATCH 20/38] Refactor console formater and test --- .../src/models/talker_data/talker_error.dart | 3 +- .../models/talker_data/talker_exception.dart | 3 +- .../src/models/talker_data/talker_log.dart | 3 +- talker_logger/lib/src/models/models.dart | 1 - .../filter/base_talker_logger_filter.dart | 0 .../src/{models => utils}/filter/filter.dart | 0 .../filter/talker_logger_filter.dart | 0 .../utils/formater/base_logger_formater.dart | 4 ++- talker_logger/lib/src/utils/utils.dart | 1 + talker_logger/test/console_formater_test.dart | 30 +++++++++++++++++++ ...st.dart => talker_logger_filter_test.dart} | 0 11 files changed, 37 insertions(+), 8 deletions(-) rename talker_logger/lib/src/{models => utils}/filter/base_talker_logger_filter.dart (100%) rename talker_logger/lib/src/{models => utils}/filter/filter.dart (100%) rename talker_logger/lib/src/{models => utils}/filter/talker_logger_filter.dart (100%) create mode 100644 talker_logger/test/console_formater_test.dart rename talker_logger/test/{talker_logger_test.dart => talker_logger_filter_test.dart} (100%) diff --git a/talker/lib/src/models/talker_data/talker_error.dart b/talker/lib/src/models/talker_data/talker_error.dart index 34f90193..399630e3 100644 --- a/talker/lib/src/models/talker_data/talker_error.dart +++ b/talker/lib/src/models/talker_data/talker_error.dart @@ -31,8 +31,7 @@ class TalkerError implements TalkerDataInterface { @override String generateTextMessage() { - final mes = '$titleText$displayMessage$displayError\n$displayStackTrace'; - return ConsoleFormater.addUnderline(mes); + return '$titleText$displayMessage$displayError\n$displayStackTrace'; } @override diff --git a/talker/lib/src/models/talker_data/talker_exception.dart b/talker/lib/src/models/talker_data/talker_exception.dart index 4ab0d9ba..27526101 100644 --- a/talker/lib/src/models/talker_data/talker_exception.dart +++ b/talker/lib/src/models/talker_data/talker_exception.dart @@ -31,8 +31,7 @@ class TalkerException implements TalkerDataInterface { @override String generateTextMessage() { - final mes = '$titleText$displayMessage$displayException$displayStackTrace'; - return ConsoleFormater.addUnderline(mes); + return '$titleText$displayMessage$displayException$displayStackTrace'; } @override diff --git a/talker/lib/src/models/talker_data/talker_log.dart b/talker/lib/src/models/talker_data/talker_log.dart index a3d93c19..10b2604c 100644 --- a/talker/lib/src/models/talker_data/talker_log.dart +++ b/talker/lib/src/models/talker_data/talker_log.dart @@ -33,8 +33,7 @@ class TalkerLog implements TalkerDataInterface { @override String generateTextMessage() { - final mes = '$titleText$message$displayAditional'; - return ConsoleFormater.addUnderline(mes); + return '$titleText$message$displayAditional'; } @override diff --git a/talker_logger/lib/src/models/models.dart b/talker_logger/lib/src/models/models.dart index 959d46c8..748fa30c 100644 --- a/talker_logger/lib/src/models/models.dart +++ b/talker_logger/lib/src/models/models.dart @@ -1,2 +1 @@ -export 'filter/filter.dart'; export 'log_level/log_level.dart'; diff --git a/talker_logger/lib/src/models/filter/base_talker_logger_filter.dart b/talker_logger/lib/src/utils/filter/base_talker_logger_filter.dart similarity index 100% rename from talker_logger/lib/src/models/filter/base_talker_logger_filter.dart rename to talker_logger/lib/src/utils/filter/base_talker_logger_filter.dart diff --git a/talker_logger/lib/src/models/filter/filter.dart b/talker_logger/lib/src/utils/filter/filter.dart similarity index 100% rename from talker_logger/lib/src/models/filter/filter.dart rename to talker_logger/lib/src/utils/filter/filter.dart diff --git a/talker_logger/lib/src/models/filter/talker_logger_filter.dart b/talker_logger/lib/src/utils/filter/talker_logger_filter.dart similarity index 100% rename from talker_logger/lib/src/models/filter/talker_logger_filter.dart rename to talker_logger/lib/src/utils/filter/talker_logger_filter.dart diff --git a/talker_logger/lib/src/utils/formater/base_logger_formater.dart b/talker_logger/lib/src/utils/formater/base_logger_formater.dart index 68474e76..cf74eaac 100644 --- a/talker_logger/lib/src/utils/formater/base_logger_formater.dart +++ b/talker_logger/lib/src/utils/formater/base_logger_formater.dart @@ -2,9 +2,11 @@ import 'package:talker_logger/talker_logger.dart'; class BaseLoggerFormater implements LoggerFormater { const BaseLoggerFormater(); + @override String fmt(String msg, LogLevel level, AnsiPen pen) { final parts = msg.split('\n'); - return parts.map((e) => pen.write(e)).join('\n'); + final coloredMsg = parts.map((e) => pen.write(e)).join('\n'); + return ConsoleFormater.addUnderline(coloredMsg); } } diff --git a/talker_logger/lib/src/utils/utils.dart b/talker_logger/lib/src/utils/utils.dart index 2f05f546..5669ac1e 100644 --- a/talker_logger/lib/src/utils/utils.dart +++ b/talker_logger/lib/src/utils/utils.dart @@ -1,2 +1,3 @@ export 'console_formater.dart'; +export 'filter/filter.dart'; export 'formater/formater.dart'; diff --git a/talker_logger/test/console_formater_test.dart b/talker_logger/test/console_formater_test.dart new file mode 100644 index 00000000..0493ef56 --- /dev/null +++ b/talker_logger/test/console_formater_test.dart @@ -0,0 +1,30 @@ +import 'package:talker_logger/talker_logger.dart'; +import 'package:test/test.dart'; + +void main() { + final cases = ["msg", "message", "Middle length message with some info"]; + + group('ConsoleFormater', () { + group('addUnderline', () { + for (final msg in cases) { + _testUnderLine(msg); + } + }); + }); +} + +void _testUnderLine(String msg) { + test('Msg $msg', () { + final underLinedMsg = ConsoleFormater.addUnderline(msg); + + expect(underLinedMsg, isNotNull); + expect(underLinedMsg, isNotEmpty); + + final lastStr = underLinedMsg.split('\n').last; + expect(lastStr, contains('_')); + expect(lastStr.length, msg.length); + expect(lastStr, '_' * msg.length); + }); +} + +TalkerLoggerFilter _getFilter(LogLevel level) => BaseTalkerLoggerFilter(level); diff --git a/talker_logger/test/talker_logger_test.dart b/talker_logger/test/talker_logger_filter_test.dart similarity index 100% rename from talker_logger/test/talker_logger_test.dart rename to talker_logger/test/talker_logger_filter_test.dart From 068cf91ac3613c3bd2f89415643e0fb807ac85c9 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 14:54:41 +0300 Subject: [PATCH 21/38] Add one case --- talker_logger/test/console_formater_test.dart | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/talker_logger/test/console_formater_test.dart b/talker_logger/test/console_formater_test.dart index 0493ef56..7005757c 100644 --- a/talker_logger/test/console_formater_test.dart +++ b/talker_logger/test/console_formater_test.dart @@ -2,7 +2,12 @@ import 'package:talker_logger/talker_logger.dart'; import 'package:test/test.dart'; void main() { - final cases = ["msg", "message", "Middle length message with some info"]; + final cases = [ + "msg", + "message", + "Middle length message with some info", + " 453#4345//c.,le", + ]; group('ConsoleFormater', () { group('addUnderline', () { @@ -14,7 +19,7 @@ void main() { } void _testUnderLine(String msg) { - test('Msg $msg', () { + test('Msg: $msg', () { final underLinedMsg = ConsoleFormater.addUnderline(msg); expect(underLinedMsg, isNotNull); @@ -26,5 +31,3 @@ void _testUnderLine(String msg) { expect(lastStr, '_' * msg.length); }); } - -TalkerLoggerFilter _getFilter(LogLevel level) => BaseTalkerLoggerFilter(level); From 239ac3ff77c7d3c880a252eee6e162ed8398b597 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:03:55 +0300 Subject: [PATCH 22/38] Add base formater tests --- .../test/talker_logger_formater_test.dart | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 talker_logger/test/talker_logger_formater_test.dart diff --git a/talker_logger/test/talker_logger_formater_test.dart b/talker_logger/test/talker_logger_formater_test.dart new file mode 100644 index 00000000..fce7b573 --- /dev/null +++ b/talker_logger/test/talker_logger_formater_test.dart @@ -0,0 +1,35 @@ +import 'package:talker_logger/talker_logger.dart'; +import 'package:test/test.dart'; + +const _formater = BaseLoggerFormater(); + +void main() { + final cases = [ + "m\ns\ng", + "m\ne\ns\ns\na\ng\ne", + "Middle\nlength\nmessage\nwith\nsome\ninfo", + " /s.f;gl,b;rlimvs'rlg't\\rgmtiu\n 453#4345//c.,le", + ]; + + group('BaseTalkerLoggerFormater', () { + group('fmt', () { + for (final msg in cases) { + _testFmt(msg); + } + }); + }); +} + +void _testFmt(String msg) { + test('Msg: $msg', () { + final fmtMsg = _formater.fmt(msg, LogLevel.debug, AnsiPen()); + + expect(fmtMsg, isNotNull); + expect(fmtMsg, isNotEmpty); + + final parts = fmtMsg.split('\n'); + final msgWithoutUnderline = parts.getRange(0, parts.length - 1).join('\n'); + + expect(msgWithoutUnderline, msg); + }); +} From 63376793f61f68670022c0b82c5b804a427f0475 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:15:53 +0300 Subject: [PATCH 23/38] Make observer real class --- talker/lib/src/observers/talker_observer.dart | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/talker/lib/src/observers/talker_observer.dart b/talker/lib/src/observers/talker_observer.dart index b7064e4d..91824c10 100644 --- a/talker/lib/src/observers/talker_observer.dart +++ b/talker/lib/src/observers/talker_observer.dart @@ -1,8 +1,12 @@ import 'package:talker/src/models/talker_data/talker_data.dart'; import 'package:talker_error_handler/talker_error_handler.dart'; -//TODO: make it real class -abstract class TalkerObserver { - Function(ErrorDetails err) get onError; - Function(TalkerDataInterface data) get onLog; +class TalkerObserver { + const TalkerObserver({ + required this.onError, + required this.onLog, + }); + + final Function(ErrorDetails err) onError; + final Function(TalkerDataInterface data) onLog; } From 535441d4f849267f38a7cd02bf6e9bb1b6503d63 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:24:20 +0300 Subject: [PATCH 24/38] Add StringBuffer --- talker/lib/src/extensions/log_level.dart | 1 - talker/lib/src/extensions/talker_data.dart | 6 +++--- talker/lib/src/talker.dart | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/talker/lib/src/extensions/log_level.dart b/talker/lib/src/extensions/log_level.dart index 627187d0..4999ee91 100644 --- a/talker/lib/src/extensions/log_level.dart +++ b/talker/lib/src/extensions/log_level.dart @@ -1,5 +1,4 @@ import 'package:talker/talker.dart'; -import 'package:talker_error_handler/talker_error_handler.dart'; extension ToLogLevel on ErrorLevel? { LogLevel get loglevel { diff --git a/talker/lib/src/extensions/talker_data.dart b/talker/lib/src/extensions/talker_data.dart index 66844069..2234460e 100644 --- a/talker/lib/src/extensions/talker_data.dart +++ b/talker/lib/src/extensions/talker_data.dart @@ -2,10 +2,10 @@ import 'package:talker/src/src.dart'; extension HistoryListText on List { String get text { - var m = ''; + final sb = StringBuffer(); for (final data in this) { - m += '${data.generateTextMessage()}\n'; + sb.write('${data.generateTextMessage()}\n'); } - return m; + return sb.toString(); } } diff --git a/talker/lib/src/talker.dart b/talker/lib/src/talker.dart index 7fc745df..920541aa 100644 --- a/talker/lib/src/talker.dart +++ b/talker/lib/src/talker.dart @@ -1,7 +1,6 @@ import 'dart:async'; import 'package:talker/talker.dart'; -import 'package:talker_error_handler/talker_error_handler.dart'; class Talker implements TalkerInterface { Talker._() { From f1291e8028afc1ae7bb4b799d0f49e513322c0b9 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:34:25 +0300 Subject: [PATCH 25/38] Fix lazy talker fields creation --- talker/lib/src/talker.dart | 107 ++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 44 deletions(-) diff --git a/talker/lib/src/talker.dart b/talker/lib/src/talker.dart index 920541aa..aa4c60be 100644 --- a/talker/lib/src/talker.dart +++ b/talker/lib/src/talker.dart @@ -5,61 +5,30 @@ import 'package:talker/talker.dart'; class Talker implements TalkerInterface { Talker._() { _settings = kDefaultTalkerSettings; + _logger = TalkerLogger(); + _errorHandler = ErrorHandler() + ..stream.listen((details) { + _handleErrorStream(details); + }); } static final _talker = Talker._(); static Talker get instance => _talker; - TalkerObserversManager? _observersManager; + /// Fields can be setup in [configure()] method + late TalkerSettings _settings; + late TalkerLogger _logger; + late ErrorHandler _errorHandler; // final _fileManager = FileManager(); final _history = []; - - late final _logger = TalkerLogger(); - late final _errorHandler = ErrorHandler() - ..stream.listen((details) { - TalkerDataInterface? data; - final err = details.error; - final exception = details.exception; - if (err != null) { - data = TalkerError( - err, - message: details.message, - stackTrace: details.stackTrace, - logLevel: details.errorLevel?.loglevel ?? LogLevel.error, - ); - } else if (exception != null) { - data = TalkerException( - exception, - message: details.message, - stackTrace: details.stackTrace, - logLevel: details.errorLevel?.loglevel ?? LogLevel.error, - ); - } - - if (data != null) { - _talkerStreamController.add(data); - _handleForOutputs(data); - _logger.log( - data.generateTextMessage(), - logLevel: data.logLevel ?? LogLevel.debug, - ); - } - }); - - final _talkerStreamController = - StreamController.broadcast(); - - @override - Stream get stream => - _talkerStreamController.stream.asBroadcastStream(); - - @override - List get history => _history; + TalkerObserversManager? _observersManager; @override Future configure({ + TalkerLogger? logger, + ErrorHandler? errorHandler, TalkerSettings? settings, List? observers, }) async { @@ -70,8 +39,29 @@ class Talker implements TalkerInterface { if (observers != null && observers.isNotEmpty) { _observersManager = TalkerObserversManager(observers); } + + if (logger != null) { + _logger = logger; + } + + if (errorHandler != null) { + _errorHandler = errorHandler + ..stream.listen((details) { + _handleErrorStream(details); + }); + } } + final _talkerStreamController = + StreamController.broadcast(); + + @override + Stream get stream => + _talkerStreamController.stream.asBroadcastStream(); + + @override + List get history => _history; + @override void handle( Object exception, [ @@ -117,7 +107,6 @@ class Talker implements TalkerInterface { @override void log( String message, { - //TODO: add default for settings LogLevel logLevel = LogLevel.debug, Map? additional, }) { @@ -162,4 +151,34 @@ class Talker implements TalkerInterface { _history.add(data); } } + + void _handleErrorStream(ErrorDetails details) { + TalkerDataInterface? data; + final err = details.error; + final exception = details.exception; + if (err != null) { + data = TalkerError( + err, + message: details.message, + stackTrace: details.stackTrace, + logLevel: details.errorLevel?.loglevel ?? LogLevel.error, + ); + } else if (exception != null) { + data = TalkerException( + exception, + message: details.message, + stackTrace: details.stackTrace, + logLevel: details.errorLevel?.loglevel ?? LogLevel.error, + ); + } + + if (data != null) { + _talkerStreamController.add(data); + _handleForOutputs(data); + _logger.log( + data.generateTextMessage(), + logLevel: data.logLevel ?? LogLevel.debug, + ); + } + } } From 946397569fd517b5de7d4d295fcd7042f1d35fcd Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:38:57 +0300 Subject: [PATCH 26/38] Add talker logger workflow --- .github/workflows/talker_logger.yaml | 66 ++++++++++++++++++++++++++++ tools/verify_pub_scroe.sh | 16 +++++++ 2 files changed, 82 insertions(+) create mode 100644 .github/workflows/talker_logger.yaml create mode 100644 tools/verify_pub_scroe.sh diff --git a/.github/workflows/talker_logger.yaml b/.github/workflows/talker_logger.yaml new file mode 100644 index 00000000..6a2c7231 --- /dev/null +++ b/.github/workflows/talker_logger.yaml @@ -0,0 +1,66 @@ +name: bloc + +on: + push: + paths: + - "talker_logger/**" + - ".github/workflows/talker_logger.yaml" + + pull_request: + paths: + - "talker_logger/**" + - ".github/workflows/talker_logger.yaml" + +jobs: + build: + defaults: + run: + working-directory: packages/bloc + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1 + + - name: Install Dependencies + run: pub get + + - name: Format + run: dart format --set-exit-if-changed . + + - name: Analyze + run: dart analyze --fatal-infos --fatal-warnings . + + - name: Run Tests + run: | + pub global activate test_coverage + export PATH=$PATH:$HOME/.pub-cache/bin + test_coverage + - name: Check Code Coverage + uses: VeryGoodOpenSource/very_good_coverage@v1.2.0 + with: + path: talker_logger/coverage/lcov.info + + # - name: Upload coverage to Codecov + # uses: codecov/codecov-action@v1 + # with: + # token: ${{ secrets.CODECOV_TOKEN }} + + pana: + defaults: + run: + working-directory: talker_logger + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2.3.4 + - uses: subosito/flutter-action@v1.5.3 + + - name: Install Dependencies + run: | + flutter packages get + flutter pub global activate pana + - name: Verify Pub Score + run: ../../tool/verify_pub_score.sh \ No newline at end of file diff --git a/tools/verify_pub_scroe.sh b/tools/verify_pub_scroe.sh new file mode 100644 index 00000000..00fab26a --- /dev/null +++ b/tools/verify_pub_scroe.sh @@ -0,0 +1,16 @@ +#!/bin/bash +# Runs `pana . --no-warning` and verifies that the package score +# is greater or equal to the desired score. By default the desired score is +# a perfect score but it can be overridden by passing the desired score as an argument. +# +# Ensure the package has a score of at least a 100 +# `./verify_pub_score.sh 100` +# +# Ensure the package has a perfect score +# `./verify_pub_score.sh` + +PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p") +echo "score: $PANA_SCORE" +IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1] +if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi +if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi \ No newline at end of file From d61950e141105e22316b6465ea037b4ead8923e1 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:41:10 +0300 Subject: [PATCH 27/38] Fix pub get --- .github/workflows/talker_logger.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/talker_logger.yaml b/.github/workflows/talker_logger.yaml index 6a2c7231..ad67bdc2 100644 --- a/.github/workflows/talker_logger.yaml +++ b/.github/workflows/talker_logger.yaml @@ -24,7 +24,7 @@ jobs: - uses: dart-lang/setup-dart@v1 - name: Install Dependencies - run: pub get + run: dart pub get - name: Format run: dart format --set-exit-if-changed . From 5f2c0c4f802c86205dee4796729683b4d747f7bc Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:42:08 +0300 Subject: [PATCH 28/38] Fix dir --- .github/workflows/talker_logger.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/talker_logger.yaml b/.github/workflows/talker_logger.yaml index ad67bdc2..c95b82d2 100644 --- a/.github/workflows/talker_logger.yaml +++ b/.github/workflows/talker_logger.yaml @@ -15,7 +15,7 @@ jobs: build: defaults: run: - working-directory: packages/bloc + working-directory: talker_logger runs-on: ubuntu-latest From 8ac2cbef6a6889fa5bb550bb210384d947aec0ac Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:42:25 +0300 Subject: [PATCH 29/38] Fix name --- .github/workflows/talker_logger.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/talker_logger.yaml b/.github/workflows/talker_logger.yaml index c95b82d2..b07767d0 100644 --- a/.github/workflows/talker_logger.yaml +++ b/.github/workflows/talker_logger.yaml @@ -1,4 +1,4 @@ -name: bloc +name: talker_logger on: push: From e20c7f72878217e22f64eafb0564e5f3f14e8e2a Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:46:09 +0300 Subject: [PATCH 30/38] Fix coverage min points --- .github/workflows/talker_logger.yaml | 24 +----------------------- tools/verify_pub_scroe.sh | 16 ---------------- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 tools/verify_pub_scroe.sh diff --git a/.github/workflows/talker_logger.yaml b/.github/workflows/talker_logger.yaml index b07767d0..c5abf935 100644 --- a/.github/workflows/talker_logger.yaml +++ b/.github/workflows/talker_logger.yaml @@ -40,27 +40,5 @@ jobs: - name: Check Code Coverage uses: VeryGoodOpenSource/very_good_coverage@v1.2.0 with: + min_coverage: 30 path: talker_logger/coverage/lcov.info - - # - name: Upload coverage to Codecov - # uses: codecov/codecov-action@v1 - # with: - # token: ${{ secrets.CODECOV_TOKEN }} - - pana: - defaults: - run: - working-directory: talker_logger - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2.3.4 - - uses: subosito/flutter-action@v1.5.3 - - - name: Install Dependencies - run: | - flutter packages get - flutter pub global activate pana - - name: Verify Pub Score - run: ../../tool/verify_pub_score.sh \ No newline at end of file diff --git a/tools/verify_pub_scroe.sh b/tools/verify_pub_scroe.sh deleted file mode 100644 index 00fab26a..00000000 --- a/tools/verify_pub_scroe.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# Runs `pana . --no-warning` and verifies that the package score -# is greater or equal to the desired score. By default the desired score is -# a perfect score but it can be overridden by passing the desired score as an argument. -# -# Ensure the package has a score of at least a 100 -# `./verify_pub_score.sh 100` -# -# Ensure the package has a perfect score -# `./verify_pub_score.sh` - -PANA=$(pana . --no-warning); PANA_SCORE=$(echo $PANA | sed -n "s/.*Points: \([0-9]*\)\/\([0-9]*\)./\1\/\2/p") -echo "score: $PANA_SCORE" -IFS='/'; read -a SCORE_ARR <<< "$PANA_SCORE"; SCORE=SCORE_ARR[0]; TOTAL=SCORE_ARR[1] -if [ -z "$1" ]; then MINIMUM_SCORE=TOTAL; else MINIMUM_SCORE=$1; fi -if (( $SCORE < $MINIMUM_SCORE )); then echo "minimum score $MINIMUM_SCORE was not met!"; exit 1; fi \ No newline at end of file From 312bd5c433c980890283727887db8b627b725f36 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:47:57 +0300 Subject: [PATCH 31/38] Add talker error handler rule --- .github/workflows/talker_error_hanlder.yaml | 44 +++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/talker_error_hanlder.yaml diff --git a/.github/workflows/talker_error_hanlder.yaml b/.github/workflows/talker_error_hanlder.yaml new file mode 100644 index 00000000..fbfa7ac6 --- /dev/null +++ b/.github/workflows/talker_error_hanlder.yaml @@ -0,0 +1,44 @@ +name: talker_error_hanlder + +on: + push: + paths: + - "talker_error_hanlder/**" + - ".github/workflows/talker_error_hanlder.yaml" + + pull_request: + paths: + - "talker_error_hanlder/**" + - ".github/workflows/talker_error_hanlder.yaml" + +jobs: + build: + defaults: + run: + working-directory: talker_error_hanlder + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1 + + - name: Install Dependencies + run: dart pub get + + - name: Format + run: dart format --set-exit-if-changed . + + - name: Analyze + run: dart analyze --fatal-infos --fatal-warnings . + + - name: Run Tests + run: | + pub global activate test_coverage + export PATH=$PATH:$HOME/.pub-cache/bin + test_coverage + - name: Check Code Coverage + uses: VeryGoodOpenSource/very_good_coverage@v1.2.0 + with: + min_coverage: 30 + path: talker_error_hanlder/coverage/lcov.info From f201544b65023325f3834d14008fda55d949369b Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:52:46 +0300 Subject: [PATCH 32/38] Fix naming and versions --- .github/workflows/talker_error_hanlder.yaml | 14 +++++++------- talker/CHANGELOG.md | 2 +- talker_error_handler/CHANGELOG.md | 2 +- talker_flutter/CHANGELOG.md | 4 ++-- talker_logger/CHANGELOG.md | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/talker_error_hanlder.yaml b/.github/workflows/talker_error_hanlder.yaml index fbfa7ac6..82d8867e 100644 --- a/.github/workflows/talker_error_hanlder.yaml +++ b/.github/workflows/talker_error_hanlder.yaml @@ -1,21 +1,21 @@ -name: talker_error_hanlder +name: talker_error_handler on: push: paths: - - "talker_error_hanlder/**" - - ".github/workflows/talker_error_hanlder.yaml" + - "talker_error_handler/**" + - ".github/workflows/talker_error_handler.yaml" pull_request: paths: - - "talker_error_hanlder/**" - - ".github/workflows/talker_error_hanlder.yaml" + - "talker_error_handler/**" + - ".github/workflows/talker_error_handler.yaml" jobs: build: defaults: run: - working-directory: talker_error_hanlder + working-directory: talker_error_handler runs-on: ubuntu-latest @@ -41,4 +41,4 @@ jobs: uses: VeryGoodOpenSource/very_good_coverage@v1.2.0 with: min_coverage: 30 - path: talker_error_hanlder/coverage/lcov.info + path: talker_error_handler/coverage/lcov.info diff --git a/talker/CHANGELOG.md b/talker/CHANGELOG.md index effe43c8..a0712a79 100644 --- a/talker/CHANGELOG.md +++ b/talker/CHANGELOG.md @@ -1,3 +1,3 @@ -## 1.0.0 +## 0.1.0 - Initial version. diff --git a/talker_error_handler/CHANGELOG.md b/talker_error_handler/CHANGELOG.md index effe43c8..a0712a79 100644 --- a/talker_error_handler/CHANGELOG.md +++ b/talker_error_handler/CHANGELOG.md @@ -1,3 +1,3 @@ -## 1.0.0 +## 0.1.0 - Initial version. diff --git a/talker_flutter/CHANGELOG.md b/talker_flutter/CHANGELOG.md index 41cc7d81..cb12c594 100644 --- a/talker_flutter/CHANGELOG.md +++ b/talker_flutter/CHANGELOG.md @@ -1,3 +1,3 @@ -## 0.0.1 +## 0.1.0 -* TODO: Describe initial release. +* Initial version diff --git a/talker_logger/CHANGELOG.md b/talker_logger/CHANGELOG.md index effe43c8..a0712a79 100644 --- a/talker_logger/CHANGELOG.md +++ b/talker_logger/CHANGELOG.md @@ -1,3 +1,3 @@ -## 1.0.0 +## 0.1.0 - Initial version. From f55b824c36792da2dedaf2ca7e4015c2d1e4a2e2 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 15:57:39 +0300 Subject: [PATCH 33/38] Add talker workflow --- .github/workflows/talker.yaml | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/talker.yaml diff --git a/.github/workflows/talker.yaml b/.github/workflows/talker.yaml new file mode 100644 index 00000000..3cd12fe3 --- /dev/null +++ b/.github/workflows/talker.yaml @@ -0,0 +1,44 @@ +name: talker + +on: + push: + paths: + - "talker/**" + - ".github/workflows/talker.yaml" + + pull_request: + paths: + - "talker/**" + - ".github/workflows/talker.yaml" + +jobs: + build: + defaults: + run: + working-directory: talker + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: dart-lang/setup-dart@v1 + + - name: Install Dependencies + run: dart pub get + + - name: Format + run: dart format --set-exit-if-changed . + + - name: Analyze + run: dart analyze --fatal-infos --fatal-warnings . + + - name: Run Tests + run: | + pub global activate test_coverage + export PATH=$PATH:$HOME/.pub-cache/bin + test_coverage + - name: Check Code Coverage + uses: VeryGoodOpenSource/very_good_coverage@v1.2.0 + with: + min_coverage: 30 + path: talker/coverage/lcov.info From c867ac315a710f12306488cfe30beb943625bcaf Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 16:06:56 +0300 Subject: [PATCH 34/38] Add talker flutter workflow --- .github/workflows/talker_flutter.yaml | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/talker_flutter.yaml diff --git a/.github/workflows/talker_flutter.yaml b/.github/workflows/talker_flutter.yaml new file mode 100644 index 00000000..c6d96867 --- /dev/null +++ b/.github/workflows/talker_flutter.yaml @@ -0,0 +1,49 @@ +name: talker_flutter + +on: + push: + paths: + - "talker_flutter/**" + - ".github/workflows/talker_flutter.yaml" + + pull_request: + paths: + - "talker_flutter/**" + - ".github/workflows/talker_flutter.yaml" + +jobs: + build: + defaults: + run: + working-directory: talker_flutter + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: "12.x" + - uses: subosito/flutter-action@v1 + with: + channel: "stable" + + - name: Install Dependencies + run: flutter pub get + + - name: Format + run: flutter format --set-exit-if-changed . + + - name: Analyze + run: flutter analyze --fatal-infos --fatal-warnings . + + - name: Run Tests + run: | + pub global activate test_coverage + export PATH=$PATH:$HOME/.pub-cache/bin + test_coverage + - name: Check Code Coverage + uses: VeryGoodOpenSource/very_good_coverage@v1.2.0 + with: + min_coverage: 30 + path: talker_flutter/coverage/lcov.info From 9481cddb493dd91c8a4eb7e09369ea2bf5db3c96 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 16:13:09 +0300 Subject: [PATCH 35/38] Fix publish field --- talker/pubspec.yaml | 1 + talker_flutter/pubspec.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/talker/pubspec.yaml b/talker/pubspec.yaml index 3f4dd543..d310806b 100644 --- a/talker/pubspec.yaml +++ b/talker/pubspec.yaml @@ -2,6 +2,7 @@ name: talker description: Advanced error handler and logger package for flutter and dart apps version: 0.1.0 homepage: https://github.com/Frezyx/talker +publish_to: none environment: sdk: '>=2.15.0 <3.0.0' diff --git a/talker_flutter/pubspec.yaml b/talker_flutter/pubspec.yaml index 9833a5e8..72e02d3f 100644 --- a/talker_flutter/pubspec.yaml +++ b/talker_flutter/pubspec.yaml @@ -2,6 +2,7 @@ name: talker_flutter description: Flutter implementation of talker (advanced error handler and logger package). version: 0.1.0 homepage: https://github.com/Frezyx/talker +publish_to: none environment: sdk: ">=2.15.0 <3.0.0" From 4a50a1a1378ce95d23986d38f4296853712d60ca Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 16:14:38 +0300 Subject: [PATCH 36/38] Fix sort deps --- talker/pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/talker/pubspec.yaml b/talker/pubspec.yaml index d310806b..189040b1 100644 --- a/talker/pubspec.yaml +++ b/talker/pubspec.yaml @@ -9,6 +9,7 @@ environment: dependencies: + intl: ^0.17.0 talker_error_handler: path: ../talker_error_handler @@ -23,7 +24,6 @@ dependencies: # url: https://github.com/Frezyx/talker # ref: testing # path: talker_logger/ - intl: ^0.17.0 dev_dependencies: lint: ^1.8.1 From 4ff3b4e11092dc3d3e8c43e36010978e661b3ce0 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 16:16:26 +0300 Subject: [PATCH 37/38] Mock test --- talker/test/talker_test.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/talker/test/talker_test.dart b/talker/test/talker_test.dart index c2c62e36..22125848 100644 --- a/talker/test/talker_test.dart +++ b/talker/test/talker_test.dart @@ -9,7 +9,7 @@ void main() { }); test('First Test', () { - // expect(awesome.isAwesome, isTrue); + expect(true, isTrue); }); }); } From f2885c7c30333276dd68d4d1c971eae6eec47e46 Mon Sep 17 00:00:00 2001 From: Stanislav Ilin Date: Thu, 6 Jan 2022 19:32:01 +0300 Subject: [PATCH 38/38] Update package version to 0.2.0 --- README.md | 2 +- talker/CHANGELOG.md | 4 ++++ talker/pubspec.yaml | 2 +- talker_error_handler/CHANGELOG.md | 6 ++++++ talker_error_handler/pubspec.yaml | 2 +- talker_flutter/CHANGELOG.md | 4 ++++ talker_flutter/example/pubspec.lock | 8 ++++---- talker_flutter/pubspec.yaml | 2 +- talker_logger/CHANGELOG.md | 4 ++++ talker_logger/pubspec.yaml | 2 +- 10 files changed, 27 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 44624767..a7c9fd46 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Talker Advanced error catching and logging for dart/flutter applications -### 0.1.0 +### 0.2.0 Working in progress \ No newline at end of file diff --git a/talker/CHANGELOG.md b/talker/CHANGELOG.md index a0712a79..be1c6281 100644 --- a/talker/CHANGELOG.md +++ b/talker/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.0 +- Simplified package api +- Fix Talker lazy configuration + ## 0.1.0 - Initial version. diff --git a/talker/pubspec.yaml b/talker/pubspec.yaml index 189040b1..8c976f8e 100644 --- a/talker/pubspec.yaml +++ b/talker/pubspec.yaml @@ -1,6 +1,6 @@ name: talker description: Advanced error handler and logger package for flutter and dart apps -version: 0.1.0 +version: 0.2.0 homepage: https://github.com/Frezyx/talker publish_to: none diff --git a/talker_error_handler/CHANGELOG.md b/talker_error_handler/CHANGELOG.md index a0712a79..3d75bc52 100644 --- a/talker_error_handler/CHANGELOG.md +++ b/talker_error_handler/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.2.0 +- Simplified package api +- Add common handle method +- Add onUnknownErrorType method + + ## 0.1.0 - Initial version. diff --git a/talker_error_handler/pubspec.yaml b/talker_error_handler/pubspec.yaml index aab1f934..fd32828a 100644 --- a/talker_error_handler/pubspec.yaml +++ b/talker_error_handler/pubspec.yaml @@ -1,6 +1,6 @@ name: talker_error_handler description: Error handler core package for talker (advanced error handler and logger package) -version: 0.1.0 +version: 0.2.0 homepage: https://github.com/Frezyx/talker environment: diff --git a/talker_flutter/CHANGELOG.md b/talker_flutter/CHANGELOG.md index cb12c594..74867dd4 100644 --- a/talker_flutter/CHANGELOG.md +++ b/talker_flutter/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.0 +- Add logs list copy method +- Fix log colors + ## 0.1.0 * Initial version diff --git a/talker_flutter/example/pubspec.lock b/talker_flutter/example/pubspec.lock index ba06904f..9900fa65 100644 --- a/talker_flutter/example/pubspec.lock +++ b/talker_flutter/example/pubspec.lock @@ -155,28 +155,28 @@ packages: path: "../../talker" relative: true source: path - version: "0.1.0" + version: "0.2.0" talker_error_handler: dependency: transitive description: path: "../../talker_error_handler" relative: true source: path - version: "0.1.0" + version: "0.2.0" talker_flutter: dependency: "direct main" description: path: ".." relative: true source: path - version: "0.1.0" + version: "0.2.0" talker_logger: dependency: transitive description: path: "../../talker_logger" relative: true source: path - version: "0.1.0" + version: "0.2.0" term_glyph: dependency: transitive description: diff --git a/talker_flutter/pubspec.yaml b/talker_flutter/pubspec.yaml index 72e02d3f..8b74fa3b 100644 --- a/talker_flutter/pubspec.yaml +++ b/talker_flutter/pubspec.yaml @@ -1,6 +1,6 @@ name: talker_flutter description: Flutter implementation of talker (advanced error handler and logger package). -version: 0.1.0 +version: 0.2.0 homepage: https://github.com/Frezyx/talker publish_to: none diff --git a/talker_logger/CHANGELOG.md b/talker_logger/CHANGELOG.md index a0712a79..de95a1f3 100644 --- a/talker_logger/CHANGELOG.md +++ b/talker_logger/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.2.0 +- Update logs architecture +- Add filter and formater utils + ## 0.1.0 - Initial version. diff --git a/talker_logger/pubspec.yaml b/talker_logger/pubspec.yaml index cda05a10..8fe32b86 100644 --- a/talker_logger/pubspec.yaml +++ b/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.1.0 +version: 0.2.0 homepage: https://github.com/Frezyx/talker environment: