Flow Coverage Report - src/utils/log.js

FilenamePercentTotalCoveredUncovered
src/utils/log.js 80 % 10 8 2
x
 
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
/* @flow */
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 { isDevelopment } from "devtools-config";
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: any[]) {
27
2x
  if (!isDevelopment()) {
28
    return;
29
  }
30
31
  console.log.apply(console, ["[log]", ...args]);
32
}
33