Skip to content
Snippets Groups Projects
Commit 2ecc5fdd authored by Greg Fodor's avatar Greg Fodor
Browse files

Properly set npm debug log filter

parent 14de33c5
No related branches found
No related tags found
No related merge requests found
...@@ -10,9 +10,6 @@ ...@@ -10,9 +10,6 @@
<link rel="shortcut icon" type="image/png" href="/favicon.ico"> <link rel="shortcut icon" type="image/png" href="/favicon.ico">
<title>Get together | Hubs by Mozilla</title> <title>Get together | Hubs by Mozilla</title>
<link href="https://fonts.googleapis.com/css?family=Zilla+Slab:300,300i,400,400i,700" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Zilla+Slab:300,300i,400,400i,700" rel="stylesheet">
<!-- HACK: this has to run after A-Frame but before our bundle, since A-Frame blows away the local storage setting -->
<script src="https://cdn.rawgit.com/gfodor/ba8f88d9f34fe9cbe59a01ce3c48420d/raw/03e31f0ef7b9eac5e947bd39e440f34df0701f75/naf-janus-adapter-logging.js" integrity="sha384-4q1V8Q88oeCFriFefFo5uEUtMzbw6K116tFyC9cwbiPr6wEe7050l5HoJUxMvnzj" crossorigin="anonymous"></script>
</head> </head>
<body> <body>
......
...@@ -3,6 +3,7 @@ console.log(`Hubs version: ${process.env.BUILD_VERSION || "?"}`); ...@@ -3,6 +3,7 @@ console.log(`Hubs version: ${process.env.BUILD_VERSION || "?"}`);
import "./assets/stylesheets/hub.scss"; import "./assets/stylesheets/hub.scss";
import "aframe"; import "aframe";
import "./utils/logging";
import { patchWebGLRenderingContext } from "./utils/webgl"; import { patchWebGLRenderingContext } from "./utils/webgl";
patchWebGLRenderingContext(); patchWebGLRenderingContext();
......
// A-Frame blows away any npm debug log filters so this allow the user to set the log filter
// via the query string.
import debug from "debug";
const qs = new URLSearchParams(location.search);
function qsTruthy(param) {
const val = qs.get(param);
// if the param exists but is not set (e.g. "?foo&bar"), its value is the empty string.
return val === "" || /1|on|true/i.test(val);
}
const isDebug = qsTruthy("debug");
const logFilter = qs.get("log_filter") || (isDebug && "naf-janus-adapter:*");
if (logFilter) {
debug.enable(logFilter);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment