question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document Realm.Sync.setSyncLogger

See original GitHub issue

Goals

To implement https://github.com/realm/realm-studio-private/issues/16 it would be great to get a way to intercept messages logged by the sync client.

Expected Results

It would be great to be able to set a callback which would get called when the client wants to log a message, overriding the default behaviour of printing to the console:

enum LogLevel {
    All = 'all'
    Trace = 'trace'
    Debug = 'debug'
    Detail = 'detail'
    Info = 'info'
    Warn = 'warn'
    Error = 'error'
    Fatal = 'fatal'
    Off = 'off'
};

Realm.Sync.setLogCallback((level: LogLevel, message: string) => {
    // Do whatever with the message ...
});

// Because `setLogCallback` was called no messages are logged to the console.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kraenhansencommented, Nov 22, 2018

I’ll try it out - thanks! I’ll give it a spin when I get to the issue then 👍 It would be awesome to get it documented though.

1reaction
nirinchevcommented, Nov 21, 2018

I don’t know if this should be a separate request, but it would be great if we could reuse that to avoid realm-js logging to the console in general - e.g. in user-methods there’s a print_error method that should use the log callback rather than the console.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Realm.App.Sync.SubscriptionsState - MongoDB
Enable multiplexing multiple sync sessions over a single connection for a Realm app. When having a lot of synchronized realms open the system...
Read more >
realm | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Disable Realm Sync only for non-premium users
I plan to sync all my User (custom document in a collection) records for all users (premium + non-premium). My guess is I...
Read more >
Scalable Realm Sync Design - YouTube
Learn what Realm is, why Sync matters, and the use cases that drive this need - empowering businesses to become mobile-first as they...
Read more >
Introduction to the MongoDB Realm Sync - Medium
Step 5: Add the Realm ID to the Android Project. Copy the Realm app ID and use it to replace App Key in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found