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:
12
mod.ts
12
mod.ts
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user