Skip to content

Commit

Permalink
improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
vasilich6107 committed Aug 8, 2024
1 parent 7c59cd4 commit 9d5d951
Show file tree
Hide file tree
Showing 37 changed files with 197 additions and 80 deletions.
4 changes: 2 additions & 2 deletions packages/generator_tests/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,14 @@ packages:
path: "../reactive_forms_annotations"
relative: true
source: path
version: "6.0.0-beta.1"
version: "6.0.0-beta.3"
reactive_forms_generator:
dependency: "direct dev"
description:
path: "../reactive_forms_generator"
relative: true
source: path
version: "6.0.0-beta.3"
version: "6.0.0-beta.5"
recase:
dependency: "direct main"
description:
Expand Down
4 changes: 4 additions & 0 deletions packages/reactive_forms_annotations/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [6.0.0-beta.3]

* improved logging

## [6.0.0-beta.2]

* improved logging
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
library reactive_forms_annotations;

export 'dart:developer' hide Flow;
export 'dart:async';
export 'package:flutter/widgets.dart';
export 'package:logging/logging.dart';
export 'package:reactive_forms/reactive_forms.dart';
Expand Down
2 changes: 1 addition & 1 deletion packages/reactive_forms_annotations/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repository: https://github.com/artflutter/reactive_forms_generator
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 6.0.0-beta.2
version: 6.0.0-beta.3

environment:
sdk: ">=3.0.0 <4.0.0"
Expand Down
8 changes: 8 additions & 0 deletions packages/reactive_forms_generator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## [6.0.0-beta.6]

* improved logging

## [6.0.0-beta.5]

* improved logging

## [6.0.0-beta.4]

* improved logging
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class UrlFormBuilder extends StatefulWidget {
class _UrlFormBuilderState extends State<UrlFormBuilder> {
late UrlForm _formModel;

StreamSubscription<LogRecord>? _logSubscription;

@override
void initState() {
_formModel = UrlForm(UrlForm.formElements(widget.model), null);
Expand All @@ -142,7 +144,7 @@ class _UrlFormBuilderState extends State<UrlFormBuilder> {

widget.initState?.call(context, _formModel);

_logUrlForm.onRecord.listen((LogRecord e) {
_logSubscription = _logUrlForm.onRecord.listen((LogRecord e) {
// use `dumpErrorToConsole` for severe messages to ensure that severe
// exceptions are formatted consistently with other Flutter examples and
// avoids printing duplicate exceptions
Expand Down Expand Up @@ -185,6 +187,7 @@ class _UrlFormBuilderState extends State<UrlFormBuilder> {
@override
void dispose() {
_formModel.form.dispose();
_logSubscription?.cancel();
super.dispose();
}

Expand All @@ -207,7 +210,7 @@ class _UrlFormBuilderState extends State<UrlFormBuilder> {
}
}

final _logUrlForm = Logger('UrlForm');
final _logUrlForm = Logger.detached('UrlForm');

class UrlForm implements FormModel<Url, Url> {
UrlForm(
Expand Down Expand Up @@ -506,7 +509,7 @@ class UrlForm implements FormModel<Url, Url> {
disabled: false);
}

final _logUrlEntityForm = Logger('UrlEntityForm');
final _logUrlEntityForm = Logger.detached('UrlEntityForm');

class UrlEntityForm implements FormModel<UrlEntity, UrlEntity> {
UrlEntityForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ class UrlOFormBuilder extends StatefulWidget {
class _UrlOFormBuilderState extends State<UrlOFormBuilder> {
late UrlOForm _formModel;

StreamSubscription<LogRecord>? _logSubscription;

@override
void initState() {
_formModel = UrlOForm(UrlOForm.formElements(widget.model), null);
Expand All @@ -142,7 +144,7 @@ class _UrlOFormBuilderState extends State<UrlOFormBuilder> {

widget.initState?.call(context, _formModel);

_logUrlOForm.onRecord.listen((LogRecord e) {
_logSubscription = _logUrlOForm.onRecord.listen((LogRecord e) {
// use `dumpErrorToConsole` for severe messages to ensure that severe
// exceptions are formatted consistently with other Flutter examples and
// avoids printing duplicate exceptions
Expand Down Expand Up @@ -185,6 +187,7 @@ class _UrlOFormBuilderState extends State<UrlOFormBuilder> {
@override
void dispose() {
_formModel.form.dispose();
_logSubscription?.cancel();
super.dispose();
}

Expand All @@ -207,7 +210,7 @@ class _UrlOFormBuilderState extends State<UrlOFormBuilder> {
}
}

final _logUrlOForm = Logger('UrlOForm');
final _logUrlOForm = Logger.detached('UrlOForm');

class UrlOForm implements FormModel<UrlO, UrlOOutput> {
UrlOForm(
Expand Down Expand Up @@ -507,7 +510,7 @@ class UrlOForm implements FormModel<UrlO, UrlOOutput> {
disabled: false);
}

final _logUrlEntityOForm = Logger('UrlEntityOForm');
final _logUrlEntityOForm = Logger.detached('UrlEntityOForm');

class UrlEntityOForm implements FormModel<UrlEntityO, UrlEntityOOutput> {
UrlEntityOForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class AnnotatelessFormBuilder extends StatefulWidget {
class _AnnotatelessFormBuilderState extends State<AnnotatelessFormBuilder> {
late AnnotatelessForm _formModel;

StreamSubscription<LogRecord>? _logSubscription;

@override
void initState() {
_formModel =
Expand All @@ -148,7 +150,7 @@ class _AnnotatelessFormBuilderState extends State<AnnotatelessFormBuilder> {

widget.initState?.call(context, _formModel);

_logAnnotatelessForm.onRecord.listen((LogRecord e) {
_logSubscription = _logAnnotatelessForm.onRecord.listen((LogRecord e) {
// use `dumpErrorToConsole` for severe messages to ensure that severe
// exceptions are formatted consistently with other Flutter examples and
// avoids printing duplicate exceptions
Expand Down Expand Up @@ -191,6 +193,7 @@ class _AnnotatelessFormBuilderState extends State<AnnotatelessFormBuilder> {
@override
void dispose() {
_formModel.form.dispose();
_logSubscription?.cancel();
super.dispose();
}

Expand All @@ -213,7 +216,7 @@ class _AnnotatelessFormBuilderState extends State<AnnotatelessFormBuilder> {
}
}

final _logAnnotatelessForm = Logger('AnnotatelessForm');
final _logAnnotatelessForm = Logger.detached('AnnotatelessForm');

class AnnotatelessForm implements FormModel<Annotateless, Annotateless> {
AnnotatelessForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class AnnotatelessOFormBuilder extends StatefulWidget {
class _AnnotatelessOFormBuilderState extends State<AnnotatelessOFormBuilder> {
late AnnotatelessOForm _formModel;

StreamSubscription<LogRecord>? _logSubscription;

@override
void initState() {
_formModel =
Expand All @@ -148,7 +150,7 @@ class _AnnotatelessOFormBuilderState extends State<AnnotatelessOFormBuilder> {

widget.initState?.call(context, _formModel);

_logAnnotatelessOForm.onRecord.listen((LogRecord e) {
_logSubscription = _logAnnotatelessOForm.onRecord.listen((LogRecord e) {
// use `dumpErrorToConsole` for severe messages to ensure that severe
// exceptions are formatted consistently with other Flutter examples and
// avoids printing duplicate exceptions
Expand Down Expand Up @@ -191,6 +193,7 @@ class _AnnotatelessOFormBuilderState extends State<AnnotatelessOFormBuilder> {
@override
void dispose() {
_formModel.form.dispose();
_logSubscription?.cancel();
super.dispose();
}

Expand All @@ -213,7 +216,7 @@ class _AnnotatelessOFormBuilderState extends State<AnnotatelessOFormBuilder> {
}
}

final _logAnnotatelessOForm = Logger('AnnotatelessOForm');
final _logAnnotatelessOForm = Logger.detached('AnnotatelessOForm');

class AnnotatelessOForm
implements FormModel<AnnotatelessO, AnnotatelessOOutput> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class ArrayNullableFormBuilder extends StatefulWidget {
class _ArrayNullableFormBuilderState extends State<ArrayNullableFormBuilder> {
late ArrayNullableForm _formModel;

StreamSubscription<LogRecord>? _logSubscription;

@override
void initState() {
_formModel =
Expand All @@ -148,7 +150,7 @@ class _ArrayNullableFormBuilderState extends State<ArrayNullableFormBuilder> {

widget.initState?.call(context, _formModel);

_logArrayNullableForm.onRecord.listen((LogRecord e) {
_logSubscription = _logArrayNullableForm.onRecord.listen((LogRecord e) {
// use `dumpErrorToConsole` for severe messages to ensure that severe
// exceptions are formatted consistently with other Flutter examples and
// avoids printing duplicate exceptions
Expand Down Expand Up @@ -191,6 +193,7 @@ class _ArrayNullableFormBuilderState extends State<ArrayNullableFormBuilder> {
@override
void dispose() {
_formModel.form.dispose();
_logSubscription?.cancel();
super.dispose();
}

Expand All @@ -213,7 +216,7 @@ class _ArrayNullableFormBuilderState extends State<ArrayNullableFormBuilder> {
}
}

final _logArrayNullableForm = Logger('ArrayNullableForm');
final _logArrayNullableForm = Logger.detached('ArrayNullableForm');

class ArrayNullableForm implements FormModel<ArrayNullable, ArrayNullable> {
ArrayNullableForm(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class DeliveryListFormBuilder extends StatefulWidget {
class _DeliveryListFormBuilderState extends State<DeliveryListFormBuilder> {
late DeliveryListForm _formModel;

StreamSubscription<LogRecord>? _logSubscription;

@override
void initState() {
_formModel =
Expand All @@ -148,7 +150,7 @@ class _DeliveryListFormBuilderState extends State<DeliveryListFormBuilder> {

widget.initState?.call(context, _formModel);

_logDeliveryListForm.onRecord.listen((LogRecord e) {
_logSubscription = _logDeliveryListForm.onRecord.listen((LogRecord e) {
// use `dumpErrorToConsole` for severe messages to ensure that severe
// exceptions are formatted consistently with other Flutter examples and
// avoids printing duplicate exceptions
Expand Down Expand Up @@ -191,6 +193,7 @@ class _DeliveryListFormBuilderState extends State<DeliveryListFormBuilder> {
@override
void dispose() {
_formModel.form.dispose();
_logSubscription?.cancel();
super.dispose();
}

Expand All @@ -213,7 +216,7 @@ class _DeliveryListFormBuilderState extends State<DeliveryListFormBuilder> {
}
}

final _logDeliveryListForm = Logger('DeliveryListForm');
final _logDeliveryListForm = Logger.detached('DeliveryListForm');

class DeliveryListForm implements FormModel<DeliveryList, DeliveryList> {
DeliveryListForm(
Expand Down Expand Up @@ -736,7 +739,7 @@ class DeliveryListForm implements FormModel<DeliveryList, DeliveryList> {
disabled: false);
}

final _logDeliveryPointForm = Logger('DeliveryPointForm');
final _logDeliveryPointForm = Logger.detached('DeliveryPointForm');

class DeliveryPointForm implements FormModel<DeliveryPoint, DeliveryPoint> {
DeliveryPointForm(
Expand Down Expand Up @@ -1022,7 +1025,7 @@ class DeliveryPointForm implements FormModel<DeliveryPoint, DeliveryPoint> {
disabled: false);
}

final _logAddressForm = Logger('AddressForm');
final _logAddressForm = Logger.detached('AddressForm');

class AddressForm implements FormModel<Address, Address> {
AddressForm(
Expand Down Expand Up @@ -1336,7 +1339,7 @@ class AddressForm implements FormModel<Address, Address> {
disabled: false);
}

final _logClientForm = Logger('ClientForm');
final _logClientForm = Logger.detached('ClientForm');

class ClientForm implements FormModel<Client, Client> {
ClientForm(
Expand Down Expand Up @@ -1988,6 +1991,8 @@ class _StandaloneDeliveryPointFormBuilderState
extends State<StandaloneDeliveryPointFormBuilder> {
late StandaloneDeliveryPointForm _formModel;

StreamSubscription<LogRecord>? _logSubscription;

@override
void initState() {
_formModel = StandaloneDeliveryPointForm(
Expand All @@ -1999,7 +2004,8 @@ class _StandaloneDeliveryPointFormBuilderState

widget.initState?.call(context, _formModel);

_logStandaloneDeliveryPointForm.onRecord.listen((LogRecord e) {
_logSubscription =
_logStandaloneDeliveryPointForm.onRecord.listen((LogRecord e) {
// use `dumpErrorToConsole` for severe messages to ensure that severe
// exceptions are formatted consistently with other Flutter examples and
// avoids printing duplicate exceptions
Expand Down Expand Up @@ -2042,6 +2048,7 @@ class _StandaloneDeliveryPointFormBuilderState
@override
void dispose() {
_formModel.form.dispose();
_logSubscription?.cancel();
super.dispose();
}

Expand All @@ -2064,7 +2071,8 @@ class _StandaloneDeliveryPointFormBuilderState
}
}

final _logStandaloneDeliveryPointForm = Logger('StandaloneDeliveryPointForm');
final _logStandaloneDeliveryPointForm =
Logger.detached('StandaloneDeliveryPointForm');

class StandaloneDeliveryPointForm
implements FormModel<DeliveryPoint, DeliveryPoint> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ class FreezedClassFormBuilder extends StatefulWidget {
class _FreezedClassFormBuilderState extends State<FreezedClassFormBuilder> {
late FreezedClassForm _formModel;

StreamSubscription<LogRecord>? _logSubscription;

@override
void initState() {
_formModel =
Expand All @@ -148,7 +150,7 @@ class _FreezedClassFormBuilderState extends State<FreezedClassFormBuilder> {

widget.initState?.call(context, _formModel);

_logFreezedClassForm.onRecord.listen((LogRecord e) {
_logSubscription = _logFreezedClassForm.onRecord.listen((LogRecord e) {
// use `dumpErrorToConsole` for severe messages to ensure that severe
// exceptions are formatted consistently with other Flutter examples and
// avoids printing duplicate exceptions
Expand Down Expand Up @@ -191,6 +193,7 @@ class _FreezedClassFormBuilderState extends State<FreezedClassFormBuilder> {
@override
void dispose() {
_formModel.form.dispose();
_logSubscription?.cancel();
super.dispose();
}

Expand All @@ -213,7 +216,7 @@ class _FreezedClassFormBuilderState extends State<FreezedClassFormBuilder> {
}
}

final _logFreezedClassForm = Logger('FreezedClassForm');
final _logFreezedClassForm = Logger.detached('FreezedClassForm');

class FreezedClassForm implements FormModel<FreezedClass, FreezedClass> {
FreezedClassForm(
Expand Down
Loading

0 comments on commit 9d5d951

Please sign in to comment.