diff --git a/packages/deriv_logger/lib/controllers/call_log_controller.dart b/packages/deriv_logger/lib/controllers/call_log_controller.dart index 60bb99f5a..e551727e0 100644 --- a/packages/deriv_logger/lib/controllers/call_log_controller.dart +++ b/packages/deriv_logger/lib/controllers/call_log_controller.dart @@ -10,9 +10,10 @@ class CallLogController extends NetworkLogsController { }) : super(emitter: callEmitter); final TextEditingController _searchController = TextEditingController(); + final List _callLogs = []; + /// Search controller for searching logs. TextEditingController get searchController => _searchController; - final List _callLogs = []; @override void incomingLog(NetworkLogPayload log) { diff --git a/packages/deriv_logger/lib/controllers/network_logs_controller.dart b/packages/deriv_logger/lib/controllers/network_logs_controller.dart index 14f7565e8..a9e18743f 100644 --- a/packages/deriv_logger/lib/controllers/network_logs_controller.dart +++ b/packages/deriv_logger/lib/controllers/network_logs_controller.dart @@ -9,15 +9,19 @@ abstract class NetworkLogsController extends ChangeNotifier { emitter?.stream.listen(incomingLog); } + /// Incoming log from the stream. void incomingLog(NetworkLogPayload log); + /// converts raw message to readable json format. String getReadableBody(Object message) { const JsonEncoder encoder = JsonEncoder.withIndent(' '); return encoder.convert(message); } + /// Checks if payload is request. bool isRequest(NetworkLogPayload log) => log.direction == LogDirection.sent; + /// It will trigger the rebuild of the widget. void searchLogs(String value) { notifyListeners(); } diff --git a/packages/deriv_logger/lib/controllers/subscription_log_controller.dart b/packages/deriv_logger/lib/controllers/subscription_log_controller.dart index 52b73d3fb..f26094162 100644 --- a/packages/deriv_logger/lib/controllers/subscription_log_controller.dart +++ b/packages/deriv_logger/lib/controllers/subscription_log_controller.dart @@ -4,7 +4,9 @@ import 'package:deriv_logger/controllers/network_logs_controller.dart'; import 'package:deriv_logger/services/network_service.dart'; import 'package:flutter/material.dart'; +/// Controller for handling subscription logs. class SubscriptionLogController extends NetworkLogsController { + /// Constructor for SubscriptionLogController. SubscriptionLogController({ NetworkLogEmitter? subscriptionEmitter, }) : super(emitter: subscriptionEmitter); diff --git a/packages/deriv_logger/lib/services/network_service.dart b/packages/deriv_logger/lib/services/network_service.dart index 2876c0db5..0702ab3df 100644 --- a/packages/deriv_logger/lib/services/network_service.dart +++ b/packages/deriv_logger/lib/services/network_service.dart @@ -1,4 +1,6 @@ abstract interface class NetworkLogEmitter { + /// A Stream of network logs. + /// Logs are displayed in UI based on this stream and [NetworkPayload]. Stream get stream; } diff --git a/packages/deriv_logger/lib/views/subscription_log_view.dart b/packages/deriv_logger/lib/views/subscription_log_view.dart index 06d0a1feb..1167ba0c0 100644 --- a/packages/deriv_logger/lib/views/subscription_log_view.dart +++ b/packages/deriv_logger/lib/views/subscription_log_view.dart @@ -4,7 +4,10 @@ import 'package:deriv_logger/views/logger_theme.dart'; import 'package:deriv_logger/widgets/controller_provider.dart'; import 'package:flutter/material.dart'; +/// This widget is used to display the subscription logs with request payload and +/// all the responses. class SubscriptionLogsView extends StatelessWidget { + /// Constructor for SubscriptionLogsView. const SubscriptionLogsView({ required this.theme, super.key,