Added global time format and log timing controls using LoggingConfiguration

* Bench doc fixes
* README fixes
* Added test scripts in `tests/`
This commit is contained in:
2025-07-19 18:51:28 -04:00
parent 44784130f9
commit 5db910ca14
8 changed files with 102 additions and 74 deletions

12
mod.ts
View File

@@ -11,11 +11,8 @@ interface UnknownConversion<T> {
converter: (arg: T) => string;
}
interface WebLike {
url?: string,
headers?: Headers,
method?: string
}
/** 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;
@@ -54,6 +51,8 @@ class Logging {
if (typeof bright == 'boolean') this.bright = bright;
if (typeof silent == 'boolean' && !silent) this.info(`Instantiated logging for ${this.source}`);
sources.add(this);
}
#conversions(...msgs: PrimitiveItems) {
@@ -341,6 +340,9 @@ class LoggingConfigurationBase {
get logTiming(): LogTiming { return this.#timing; }
set logTiming(data: LogTiming) { this.#timing = data }
set resetTimeFormat(data: TimeFormat) { for (const source of sources.values()) source.timeFormat = data; this.#timeType = data; }
set resetLogTiming(data: LogTiming) { for (const source of sources.values()) source.logTiming = data; this.#timing = data; }
}
/**
* Configure time display format and log timing here