Logger implementation#71
Open
itzmanish wants to merge 3 commits into
Open
Conversation
fix: relay url
Add lib/common/logger.ts — a zero-dependency, single-dispatcher logger: - LogLevel type: "*" | "trace" | "debug" | "info" | "warn" | "error" | "none" - Logger interface: optional level() + per-level methods; library calls level() before every emit so consumers own their own filtering - Default: built-in console logger at "error" level - setGlobalLogger(logger) / setGlobalLogger(undefined) to install or restore - createConsoleLogger(level) helper for consumers who just want a different verbosity on the built-in output - notifyLoggerLevelChanged() to re-sync workers when level changes at runtime - getLogger() — called once at module level with no args; derives scope automatically from the call stack (e.g. "transport/connection"), returns a frozen ScopedLogger that closes over scope and calls the single dispatcher - Worker propagation: getWorkerLogger() / getWorkletLogger() for Web Worker and AudioWorklet; setWorkerLogLevel() / setWorkletLogLevel() wired to ToWorker.logLevel and worklet message.logLevel; installWorkerLogReceiver() / installWorkletLogReceiver() on the main thread route FromWorker.log records into the global logger; Backend sends initial log level and re-syncs on every setGlobalLogger call via onLoggerLevelChange() - All output prefixed with "[MoQJS]" and "[<scope>]" as leading args so consumers can filter or format independently Migrate all console.* call sites in lib/** to scoped loggers: - error: caught failures, decoder/encoder errors, fatal stream errors - warn: dropped chunks/frames, missing elements, unsupported APIs - debug: lifecycle transitions, setup details, subscribe/publish state - trace: per-object/per-frame chatty logs, protocol payload dumps Re-export public logger API (setGlobalLogger, getGlobalLogger, createConsoleLogger, notifyLoggerLevelChanged, Logger, LogLevel) from all three entry points so consumers of any bundle variant can configure logging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.