Files
discord-decomp/_bundle/log.js
T
2026-11-01 12:12:55 +02:00

124 lines
3.9 KiB
JavaScript

// Metro module 4 (f5).
import * as _Module6 from "./Module6";
import { checkLogForPII } from "./Module6";
let nativeLog;
const log2 = () => {};
nativeLog = () => {};
export function setLogFn(a0) {
log2 = a0;
}
export function setNativeLogFn(a0) {
nativeLog = a0;
}
export function defaultLogFn(a0, a1, a2) {
Array.prototype.slice.call(arguments, 3);
}
export class Logger {
constructor(name = "default") {
let c12094_0, c12094_1;
const _this = this;
this.logDangerously = function logDangerously(a0, ...args) {
log2.apply(void 0, [_this.name, "log", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "log", a0, ...args]);
}
}
};
this.log = function log(a0, ...args) {
checkLogForPII.apply(_Module6, [a0, ...args]);
log2.apply(void 0, [_this.name, "log", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "log", a0, ...args]);
}
}
};
this.verboseDangerously = function verboseDangerously(a0, ...args) {
log2.apply(void 0, [_this.name, "debug", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "debug", a0, ...args]);
}
}
};
this.verbose = function verbose(a0, ...args) {
checkLogForPII.apply(_Module6, [a0, ...args]);
log2.apply(void 0, [_this.name, "debug", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "debug", a0, ...args]);
}
}
};
this.info = function info(a0, ...args) {
checkLogForPII.apply(_Module6, [a0, ...args]);
log2.apply(void 0, [_this.name, "info", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "info", a0, ...args]);
}
}
};
this.warn = function warn(a0, ...args) {
checkLogForPII.apply(_Module6, [a0, ...args]);
log2.apply(void 0, [_this.name, "warn", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "warn", a0, ...args]);
}
}
};
this.error = function error(a0, ...args) {
checkLogForPII.apply(_Module6, [a0, ...args]);
log2.apply(void 0, [_this.name, "error", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "error", a0, ...args]);
}
}
};
this.trace = function trace(a0, ...args) {
log2.apply(void 0, [_this.name, "trace", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "trace", a0, ...args]);
}
}
};
this.time = (a0, a1) => {
const r7 = Date.now();
const r9 = a1();
_this.log(a0, Date.now() - r7);
return r9;
};
c12094_0 = void 0;
c12094_1 = this;
c12094_0 = async (c28542_0, c28542_1) => {
let c28542_3;
c28542_3 = void 0;
let c31126_0 = c28542_0;
let c31126_1 = Date.now();
let c31126_2 = await c28542_1();
c12094_1.log(c31126_0, Date.now() - c31126_1 + "ms");
return c31126_2;
};
this.timeAsync = function() {
return c12094_0.apply(this, arguments);
};
this.fileOnly = function fileOnly(a0, ...args) {
log2.apply(void 0, [_this.name, "file-only", a0, ...args]);
if (_this.nativeLoggerEnabled) {
if (nativeLog != null) {
nativeLog.apply(void 0, [_this.name, "file-only", a0, ...args]);
}
}
};
this.name = name;
this.nativeLoggerEnabled = false;
}
enableNativeLogger(a0) {
this.nativeLoggerEnabled = a0;
}
}