Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const debug = require('debug')
const util = require('util')
debug.recorded = []
// enable all logs while running the tests
debug.enable('thumbsup:*')
// don't format the logs to avoid any extra ANSI codes
debug.formatArgs = function (args) {
}
// capture the logs instead of displaying them
debug.log = function () {
const message = util.format.apply(null, arguments)
debug.recorded.push(`${this.namespace} ${message}`)
}
debug.reset = function () {
debug.recorded = []
}
debug.assertContains = function (expected) {
const matches = debug.recorded.filter(message => {
return message.includes(expected)
})
}
} else {
try {
alog = require('./build/Release/silk-alog.node');
} catch (err) {
// Fall back to using console.*
}
}
// If DEBUG environment variable is not set, select a sensible default.
if (!process.env.DEBUG) {
debug.enable('silk-*,-silk-*:debug,-silk-*:verbose');
}
}
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;
};
* This is the device version of ./index.js
*
* TODO: Unify with index.js
*/
'use strict';
const debug = require('debug');
const os = require('os');
const util = require('util');
const isAndroid = os.platform() === 'android';
const alog = isAndroid ? require('silk-alog') : undefined;
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 ];
};
function overrideDebugFormat () {
debug.formatArgs = function (args) {
const prefix = new Date().toISOString() + ' ' + this.namespace + ' '
args[0] = prefix + args[0].split('\n').join('\n' + prefix)
}
}
import debug from 'debug'
import { version } from '../package.json'
const FORMAT_ARGS_BACKUP_KEY = '__formatArgs'
if (!debug[FORMAT_ARGS_BACKUP_KEY]) {
debug[FORMAT_ARGS_BACKUP_KEY] = debug.formatArgs
}
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()
import debug from 'debug'
import { version } from '../package.json'
const FORMAT_ARGS_BACKUP_KEY = '__formatArgs'
if (!debug[FORMAT_ARGS_BACKUP_KEY]) {
debug[FORMAT_ARGS_BACKUP_KEY] = debug.formatArgs
}
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()
/**
* Created by Derwish (derwish.pro@gmail.com) on 04.07.2016.
* License: http://www.gnu.org/licenses/gpl-3.0.txt
*/
//set DEBUG environment variable if nod defined
if (!process.env.DEBUG)
process.env.DEBUG = "server:*,gateway:*,-gateway:mys:log*,nodes:*,container:*";
process.env.DEBUG_DIFF = 0;
//set debug format (added time stamp)
var deb = require('debug');
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
sdata += '[' + (name.indexOf('@') !== -1 ? name : sdname(name)) + '@' + options.pen
keys.forEach(function (pname) {
if ((typeof value[pname] !== 'string') &&
(typeof value[pname] !== 'number') &&
(typeof value[pname] !== 'boolean')) { return }
sdata += ' ' + sdname(pname) + '="' + sdvalue(value[pname]) + '"'
})
sdata += ']'
})
return sdata
}
debug.formatArgs = function () {
var args = [ '' ]
var name = this.namespace
var prefix = initial
if (this.useColors) { name = '\u001b[3' + this.color + ';1m' + name + '\u001b[0m' }
underscore.rest(arguments).forEach(function (arg) {
var truths, value
var keys = underscore.keys(arg)
if (keys[0] === 'sdebug') {
prefix = sdelement(arg.sdebug)
} else if (keys[0] !== 'tags') {
args.push(arg)
} else {
value = arg.tags