diff --git a/deno.json b/deno.json index 30e18c0..f24be7e 100644 --- a/deno.json +++ b/deno.json @@ -3,6 +3,7 @@ "test-conversion": "deno run -A tests/convert.ts", "test-global": "deno run -A tests/global.ts", "test-timing": "deno run -A tests/timing.ts", + "test-basic": "deno run -A tests/basic.ts", "bench": "deno bench -A" }, "imports": { @@ -10,7 +11,7 @@ "chalk": "npm:chalk@^5.3.0" }, "exports": "./mod.ts", - "version": "1.5.0", + "version": "1.5.1", "name": "@proxnet/undead-logging", "license": "MIT", "bench": { diff --git a/mod.ts b/mod.ts index 4253365..3e15b18 100644 --- a/mod.ts +++ b/mod.ts @@ -22,9 +22,6 @@ interface LoggingOptions { /** Control all log sources from this module */ const sources: Set = 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`); } } diff --git a/tests/basic.ts b/tests/basic.ts new file mode 100644 index 0000000..d37fe95 --- /dev/null +++ b/tests/basic.ts @@ -0,0 +1,7 @@ +import Logging from "@proxnet/undead-logging"; + +const log = new Logging("Test"); + +log.i('Hello World! 1'); +log.d('Hello World! 2'); +log.n('Hello World! 3'); \ No newline at end of file