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

21
tests/convert.ts Normal file
View File

@@ -0,0 +1,21 @@
import Logging, { LoggingListeners } from "../mod.ts";
import process from "node:process";
const debug = process.argv[process.argv.length - 1] == 'true';
console.debug(`Debug mode: ${debug}`);
const changeTimeFormat = process.argv[process.argv.length - 2] == 'true';
console.debug(`changeTimeFormat: ${changeTimeFormat}`);
if (debug) {
LoggingListeners.onmsg('basic', msg => {
console.debug(`\r\n[d] ${msg}`);
});
LoggingListeners.onmsg('type', (msg, type, source, time) => {
console.debug(`[D] M:'${msg}' T:${type} S:'${source}' TM:${time.getTime()}`);
});
}
const webLog = new Logging("Web");
webLog.d(`Following is a Request`);
webLog.i(new Request('http://example.com?hello=world', { headers: { 'key1': 'value1', 'key2': 'value2' }}));
webLog.d(`Following is a Response`);
webLog.i(await fetch('https://example.com'));