Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function track(payload = {}) : LoggerType {
if (!isBrowser()) {
return logger; // eslint-disable-line no-use-before-define
}
const trackingPayload : Payload = objFilter(payload);
for (const builder of trackingBuilders) {
extendIfDefined(trackingPayload, builder(trackingPayload));
}
print(LOG_LEVEL.DEBUG, 'track', trackingPayload);
tracking.push(trackingPayload);
return logger; // eslint-disable-line no-use-before-define
}
function log(level, event, payload) {
if (payload === void 0) {
payload = {};
}
if (!isBrowser()) {
return logger; // eslint-disable-line no-use-before-define
}
if (prefix) {
event = prefix + "_" + event;
}
var logPayload = _extends({}, objFilter(payload), {
timestamp: Date.now().toString()
});
for (var _i6 = 0; _i6 < payloadBuilders.length; _i6++) {
var builder = payloadBuilders[_i6];
extendIfDefined(logPayload, builder(logPayload));
}
enqueue(level, event, logPayload);
print(level, event, logPayload);
return logger; // eslint-disable-line no-use-before-define
}
function track(payload) {
if (payload === void 0) {
payload = {};
}
if (!isBrowser()) {
return logger; // eslint-disable-line no-use-before-define
}
var trackingPayload = objFilter(payload);
for (var _i8 = 0; _i8 < trackingBuilders.length; _i8++) {
var builder = trackingBuilders[_i8];
extendIfDefined(trackingPayload, builder(trackingPayload));
}
print(LOG_LEVEL.DEBUG, 'track', trackingPayload);
tracking.push(trackingPayload);
return logger; // eslint-disable-line no-use-before-define
}
function log(level : $Values, event : string, payload = {}) : LoggerType {
if (!isBrowser()) {
return logger; // eslint-disable-line no-use-before-define
}
if (prefix) {
event = `${ prefix }_${ event }`;
}
const logPayload : Payload = {
...objFilter(payload),
timestamp: Date.now().toString()
};
for (const builder of payloadBuilders) {
extendIfDefined(logPayload, builder(logPayload));
}
enqueue(level, event, logPayload);
print(level, event, logPayload);
return logger; // eslint-disable-line no-use-before-define
}