Skip to content

Commit

Permalink
No need to round-trip logger through native code, now that it is a st…
Browse files Browse the repository at this point in the history
…atic member on Realm class
  • Loading branch information
nielsenko committed May 24, 2022
1 parent f47cbe5 commit d16319d
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/src/native/realm_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1029,7 +1029,7 @@ class _RealmCore {

static void _logCallback(Pointer<Void> userdata, int levelAsInt, Pointer<Int8> message) {
try {
final logger = userdata.toObject<Logger>(isPersistent: true)!;
final logger = Realm.logger;
final level = _LogLevel.values[levelAsInt].loggerLevel;

// Don't do expensive utf8 to utf16 conversion unless we have to..
Expand All @@ -1048,12 +1048,11 @@ class _RealmCore {
_realmLib.realm_sync_client_config_set_base_file_path(handle._pointer, configuration.baseFilePath.path.toUtf8Ptr(arena));
_realmLib.realm_sync_client_config_set_metadata_mode(handle._pointer, configuration.metadataPersistenceMode.index);

final logger = Realm.logger;
_realmLib.realm_sync_client_config_set_log_level(handle._pointer, _LogLevel.fromLevel(logger.level).index);
_realmLib.realm_sync_client_config_set_log_level(handle._pointer, _LogLevel.fromLevel(Realm.logger.level).index);
_realmLib.realm_dart_sync_client_config_set_log_callback(
handle._pointer,
Pointer.fromFunction(_logCallback),
logger.toPersistentHandle(),
nullptr,
_realmLib.addresses.realm_dart_delete_persistent_handle,
scheduler.handle._pointer,
);
Expand Down

0 comments on commit d16319d

Please sign in to comment.