This three-line JavaScript utility defines an enhanced debug logging function

This three-line JavaScript utility defines an enhanced debug logging function. When called as log(label, v), it outputs not only a custom label and value but also key numerical environment metrics retrievable from the browser. Specifically, it collects the number of logical CPU cores (navigator.hardwareConcurrency), available device memory (navigator.deviceMemory in GB), network downlink speed (navigator.connection.downlink in Mbps), round-trip time (navigator.connection.rtt in ms), and the current window dimensions (innerWidth and innerHeight). This makes it easier to capture runtime context and detect environment-dependent issues. By embedding these quantitative details directly into every log, developers gain clearer insight into execution conditions, which significantly improves debugging efficiency and reduces reproduction effort.

Comments

Popular posts from this blog

Japan Jazz Anthology Select: Jazz of the SP Era

In practice, the most workable approach is to measure a composite “civility score” built from multiple indicators.