A promise that resolves once the initial settings have been applied
void initRemoteLogs();
new Logger('Cache').warn('Miss'); // also sent to PostHog Logs when enabled
export async function initRemoteLogs(): Promise<void> {
if (typeof window === 'undefined' || typeof document === 'undefined') {
return;
}
if (import.meta.env.MODE === 'test' || __IS_E2E_BUILD__) {
return;
}
// Register right away so startup logs are buffered; applySettings detaches it if sending is off.
Logger.setRemoteSink(sink);
if (!watching) {
watching = true;
cstorage.onChanged.addListener((changes) => {
if (CACHE.USER_SETTINGS in changes) {
void applySettings();
}
});
}
await applySettings();
}
Starts forwarding
Loggeroutput to PostHog Logs on the current extension page. Safe to call more than once. Does nothing outside a page with a DOM (the service worker), in tests, or in the e2e build; stops again if the user opts out of usage sharing.