How to use the debug.humanize function in debug

To help you get started, we’ve selected a few debug examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github silklabs / silk / log / device.js View on Github external
debug.formatArgs = function() {
  const args = Array.prototype.slice.call(arguments);
  const diff = debug.humanize(this.diff);

  // Mimic console.* functions by treating additional arguments as
  // printf-style arguments.
  let msg = util.format.apply(this, args);

  const format = `(+${diff}) ${msg}`;
  if (this.useColors) {
    msg = `\u001b[3${this.color}m${format}\u001b[0m`;
  } else {
    msg = format;
  }

  return [ msg ];
};
github silklabs / silk / log / index.js View on Github external
debug.formatArgs = function(args) {
  const diff = debug.humanize(this.diff);

  // Mimic console.* functions by treating additional arguments as
  // printf-style arguments.
  let msg = util.format.apply(util, args);
  args.length = 1;

  const format = `(+${diff}) ${msg}`;
  if (this.useColors) {
    msg = `\u001b[3${this.color}m${format}\u001b[0m`;
  } else {
    msg = format;
  }

  args[0] = msg;
};
github liquality / chainabstractionlayer / packages / debug / lib / index.js View on Github external
debug.formatArgs = function (args) {
  const log = {
    args: args.concat([]),
    namespace: this.namespace,
    diff: debug.humanize(this.diff),
    time: new Date().toISOString()
  }

  try {
    throw Error('')
  } catch (error) {
    log.stack = error.stack.split('\n')

    log.stack.shift()
    log.stack.shift()
    log.stack.shift()

    log.stack = log.stack.map(trace => trace.trim())
  }

  if (!console.history) {
github derwish-pro / singlehub / modules / debug / configure.js View on Github external
deb.formatArgs = function formatArgs() {
    var args = arguments;
    var useColors = this.useColors;
    var name = this.namespace;
    var c = this.color;
    args[0] = (new Date()).toLocaleString() +
        '  \u001b[3' + c + 'm' + name + ' '
        + '\u001b[0m'
        + args[0] + '\u001b[3' + c + 'm'
        + ' +' + deb.humanize(this.diff) + '\u001b[0m';
    return args;
};
//# sourceMappingURL=configure.js.map