earthstar-project / earthstar

Storage for private, distributed, offline-first applications.
https://earthstar-project.org
GNU Lesser General Public License v3.0
634 stars 20 forks source link

Lots of messages in the console about syncing #69

Closed sgwilym closed 3 years ago

sgwilym commented 3 years ago

What's the problem you want solved?

Earthstar logs a lot of messages to do with syncing while being used (and even when syncing is not enabled). These also pop up in places like test environments, where it becomes a bit of a drag searching for your test errors among hundreds of these messages.

They also appear in any web app that uses earthstar, which creates a similar problem with noise.

CleanShot 2021-02-16 at 14 52 34@2x

Is there a solution you'd like to recommend?

Could this logging only be done if a certain argument is passed somewhere?

cinnamon-bun commented 3 years ago

How about a global singleton that sets log detail levels?

import {
    setLogLevels
} from 'earthstar'

setLogLevels({
    // many various kinds of logs, each default to zero but can be increased for more detail
    sync: 2,
    storage: 1,
});
sgwilym commented 3 years ago

@cinnamon-bun Something like that sounds great. Maybe I'll take a crack at this myself!

cinnamon-bun commented 3 years ago

@sgwilym

The various kinds of log messages are defined in src/util/log.ts.