mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-05-17 13:40:20 -04:00
debugging work
This commit is contained in:
parent
739df7c427
commit
d6b1c20906
71 changed files with 4155 additions and 3616 deletions
|
@ -8,6 +8,7 @@ import 'package:intl/intl.dart';
|
|||
import 'package:loggy/loggy.dart';
|
||||
import 'package:veilid_support/veilid_support.dart';
|
||||
|
||||
import '../proto/proto.dart';
|
||||
import '../veilid_processor/views/developer.dart';
|
||||
import 'state_logger.dart';
|
||||
|
||||
|
@ -121,6 +122,7 @@ class CallbackPrinter extends LoggyPrinter {
|
|||
callback?.call(record);
|
||||
}
|
||||
|
||||
// Change callback function
|
||||
// ignore: use_setters_to_change_properties
|
||||
void setCallback(void Function(LogRecord)? cb) {
|
||||
callback = cb;
|
||||
|
@ -147,6 +149,7 @@ void initLoggy() {
|
|||
logOptions: getLogOptions(null),
|
||||
);
|
||||
|
||||
// Allow trace logging from the command line
|
||||
// ignore: do_not_use_environment
|
||||
const isTrace = String.fromEnvironment('LOG_TRACE') != '';
|
||||
LogLevel logLevel;
|
||||
|
@ -159,5 +162,8 @@ void initLoggy() {
|
|||
Loggy('').level = getLogOptions(logLevel);
|
||||
|
||||
// Create state logger
|
||||
registerVeilidProtoToDebug();
|
||||
registerVeilidDHTProtoToDebug();
|
||||
registerVeilidchatProtoToDebug();
|
||||
Bloc.observer = const StateLogger();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:loggy/loggy.dart';
|
||||
import 'package:veilid_support/veilid_support.dart';
|
||||
import 'loggy.dart';
|
||||
|
||||
const Map<String, LogLevel> _blocChangeLogLevels = {
|
||||
|
@ -38,7 +41,12 @@ class StateLogger extends BlocObserver {
|
|||
void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) {
|
||||
super.onChange(bloc, change);
|
||||
_checkLogLevel(_blocChangeLogLevels, LogLevel.debug, bloc, (logLevel) {
|
||||
log.log(logLevel, 'Change: ${bloc.runtimeType} $change');
|
||||
const encoder = JsonEncoder.withIndent(' ', DynamicDebug.toDebug);
|
||||
log.log(
|
||||
logLevel,
|
||||
'Change: ${bloc.runtimeType}\n'
|
||||
'currentState: ${encoder.convert(change.currentState)}\n'
|
||||
'nextState: ${encoder.convert(change.nextState)}\n');
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue