Why did I need that?
This commit is contained in:
12
mod.ts
12
mod.ts
@@ -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`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user