Why did I need that?

This commit is contained in:
2025-08-28 15:21:16 -04:00
parent 6a7c6eb40b
commit 8073e044a7
3 changed files with 11 additions and 11 deletions

12
mod.ts
View File

@@ -22,9 +22,6 @@ interface LoggingOptions {
/** Control all log sources from this module */
const sources: Set<Logging> = new Set();
/** The first log message across all sources will not contain carriage return + newline control codes */
let first = true;
/**
* A source for pretty and cool and fun logging
*/
@@ -175,18 +172,13 @@ class Logging {
const str = this.#conversions(...msgs);
const msg = `${chalk.gray(this.#timeStr(time))} ${chalkColor(chalk.inverse(`${this.source} ${this.#typeStr(type)}`) + ` ${str}`)}`
process.stdout.write(`${first ? '' : '\r\n'}${msg}`);
// I don't know if promise-ifying this helps or not.
// deno-lint-ignore require-await
(async () => {
first = false;
})();
process.stdout.write(`${msg}\r\n`);
try {
LoggingListeners.emit('basic', msg);
LoggingListeners.emit('type', str, type, this.source, time);
} catch (err) {
process.stderr.write(`\r\n(FALLBACK ERROR) Callback failed! Stack: ${(err as Error).stack}`);
process.stderr.write(`(FALLBACK ERROR) Callback failed! Stack: ${(err as Error).stack}\r\n`);
}
}