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

Filter out node logs below Info level #848

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.content.SharedPreferences
import breez_sdk.ConnectRequest
import breez_sdk.EnvironmentType
import breez_sdk.GreenlightNodeConfig
import breez_sdk.LevelFilter
import breez_sdk.LogEntry
import breez_sdk.NodeConfig
import breez_sdk.defaultConfig
Expand Down Expand Up @@ -33,7 +34,7 @@ class BreezForegroundService : ForegroundService() {
super.onCreate()
Logger.tag(TAG).debug { "Creating Breez foreground service..." }
registerNotificationChannels(applicationContext, DEFAULT_CLICK_ACTION)
val sdkLogListener = SdkLogInitializer.initializeNodeLogStream()
val sdkLogListener = SdkLogInitializer.initializeNodeLogStream(LevelFilter.DEBUG)
sdkLogListener.subscribe(serviceScope) { l: LogEntry ->
when (l.level) {
"ERROR" -> Logger.tag(TAG).error { l.line }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class NotificationService: SDKNotificationService {
setLogger(logger: logger)
// Use the same SdkLogListener(:LogStream) to listen in on BreezSDK node logs
do {
try setLogStream(logStream: logger)
try setLogStream(logStream: logger, filterLevel: LevelFilter.debug)
} catch let e {
self.logger.log(tag: TAG, line:"Failed to set log stream: \(e)", level: "ERROR")
}
Expand Down
2 changes: 1 addition & 1 deletion lib/logger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void printWrapped(Logger log, String text) {

class BreezLogger {
BreezLogger() {
Logger.root.level = Level.INFO;
Logger.root.level = Level.CONFIG;

if (kDebugMode) {
Logger.root.onRecord.listen((record) {
Expand Down
3 changes: 2 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import 'dart:async';
import 'dart:io';

import 'package:breez_sdk/bridge_generated.dart';
import 'package:c_breez/bloc/account/account_bloc.dart';
import 'package:c_breez/bloc/account/credentials_manager.dart';
import 'package:c_breez/bloc/backup/backup_bloc.dart';
Expand Down Expand Up @@ -53,7 +54,7 @@ void main() async {
var breezLogger = injector.breezLogger;
final breezSDK = injector.breezSDK;
if (!await breezSDK.isInitialized()) {
breezSDK.initialize();
breezSDK.initialize(filterLevel: LevelFilter.Debug);
breezLogger.registerBreezSdkLog(breezSDK);
}

Expand Down
Loading