2022-02-23 13:52:06 +00:00
|
|
|
/**
|
2023-06-25 10:00:43 +00:00
|
|
|
* Log something to the console under the debug level.
|
2022-02-23 13:52:06 +00:00
|
|
|
* @param thing The thing to log.
|
|
|
|
* @param force If true, ignores whether or not debug logging is enabled.
|
|
|
|
*/
|
|
|
|
export function log(thing: any, force = false): void {
|
2023-06-23 10:52:03 +00:00
|
|
|
let overrideStyle = "";
|
|
|
|
let prefix = "[TRX]";
|
2022-02-23 13:52:06 +00:00
|
|
|
if (force) {
|
2023-06-23 10:52:03 +00:00
|
|
|
prefix = "%c" + prefix;
|
|
|
|
overrideStyle = "background-color: #dc322f; margin-right: 9px;";
|
2022-02-23 13:52:06 +00:00
|
|
|
}
|
|
|
|
|
2023-06-23 10:52:03 +00:00
|
|
|
if (window.TildesReExtended?.debug || $dev || force) {
|
2022-02-23 13:52:06 +00:00
|
|
|
if (overrideStyle.length > 0) {
|
|
|
|
console.debug(prefix, overrideStyle, thing);
|
|
|
|
} else {
|
|
|
|
console.debug(prefix, thing);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|