Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove log library from sdk and move logs for the app #505

Merged
merged 1 commit into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 2 additions & 27 deletions libs/sdk-flutter/lib/breez_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@ import 'dart:typed_data';

import 'package:breez_sdk/bridge_generated.dart';
import 'package:breez_sdk/native_toolkit.dart';
import 'package:fimber/fimber.dart';
import 'package:rxdart/rxdart.dart';

class BreezSDK {
final _lnToolkit = getNativeToolkit();
final _log = FimberLog("BreezSDK");

BreezSDK();

Expand All @@ -26,7 +24,6 @@ class BreezSDK {
void initialize() {
/// Listen to BreezEvent's(new block, invoice paid, synced)
_lnToolkit.breezEventsStream().listen((event) async {
_log.v("Received breez event: $event");
if (event is BreezEvent_InvoicePaid) {
_invoicePaidStream.add(event.details);
await fetchNodeData();
Expand All @@ -50,11 +47,10 @@ class BreezSDK {
_backupStreamController.addError(Exception(event.details.error));
}
});

/// Listen to SDK logs and log them accordingly to their severity
_lnToolkit.breezLogStream().listen(_registerToolkitLog);
}

Stream<LogEntry> get logStream => _lnToolkit.breezLogStream();

/* Breez Services API's & Streams*/

/// Listen to node state
Expand Down Expand Up @@ -434,27 +430,6 @@ class BreezSDK {
await nodeInfo();
await listPayments(request: const ListPaymentsRequest(filter: PaymentTypeFilter.All));
}

/// Log entries according to their severity
void _registerToolkitLog(LogEntry log) {
switch (log.level) {
case "ERROR":
_log.e(log.line);
break;
case "WARN":
_log.w(log.line);
break;
case "INFO":
_log.i(log.line);
break;
case "DEBUG":
_log.d(log.line);
break;
default:
_log.v(log.line);
break;
}
}
}

extension SDKConfig on Config {
Expand Down
8 changes: 0 additions & 8 deletions libs/sdk-flutter/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.1.4"
fimber:
dependency: "direct main"
description:
name: fimber
sha256: "42fcfa33acd43556c1e7ebfc12c2b03893418bc04a07931368c3573e228af2f0"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
fixnum:
dependency: transitive
description:
Expand Down
1 change: 0 additions & 1 deletion libs/sdk-flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ environment:
dependencies:
flutter:
sdk: flutter
fimber: ^0.7.0
### flutter_rust_bridge_codegen dependencies
ffi: ^2.0.2
flutter_rust_bridge: 1.75.2
Expand Down