tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

log.js (672B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 /*       */
      6 
      7 /**
      8 *
      9 * Utils for logging to the console
     10 * Suppresses logging in non-development environment
     11 *
     12 * @module utils/log
     13 */
     14 
     15 import { prefs } from "./prefs";
     16 
     17 /**
     18 * Produces a formatted console log line by imploding args, prefixed by [log]
     19 *
     20 * function input: log(["hello", "world"])
     21 * console output: [log] hello world
     22 *
     23 * @memberof utils/log
     24 * @static
     25 */
     26 export function log(...args) {
     27  if (prefs.logging) {
     28    console.log(...args);
     29  }
     30 }