2017-08-23 14:45:03 +00:00
|
|
|
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
const index_1 = require("./index");
|
2018-10-05 18:38:33 +00:00
|
|
|
const crypto_1 = require("crypto");
|
2017-08-23 14:45:03 +00:00
|
|
|
index_1.Logging.log("test");
|
|
|
|
index_1.Logging.log("i", "am", { a: "an" }, 1000);
|
|
|
|
index_1.Logging.error(new Error("fehler 001"));
|
|
|
|
index_1.Logging.debug("Some Debug infos");
|
|
|
|
index_1.Logging.errorMessage("i", "am", "an", "error");
|
2018-04-09 18:02:34 +00:00
|
|
|
index_1.Logging.log("\x1b[31m\x1b[31m\x1b[31m\x1b[31m\x1b[31m\x1b[31m TEST \x1b[31m\x1b[31m\x1b[31m");
|
2018-05-10 18:11:53 +00:00
|
|
|
let err = new Error();
|
|
|
|
if (typeof err.stack !== "string")
|
|
|
|
console.log("Stacktrace invalid", err.stack);
|
2018-09-01 17:17:59 +00:00
|
|
|
let cus = new index_1.LoggingBase({ name: "test" });
|
|
|
|
cus.log("Hello from custom Logger");
|
2018-09-28 10:37:13 +00:00
|
|
|
let cus2 = new index_1.LoggingBase("test2");
|
|
|
|
cus2.log("Hello from custom Logger 2");
|
2018-10-05 11:16:49 +00:00
|
|
|
let cus22 = new index_1.LoggingBase("test2");
|
|
|
|
cus22.log("Hello from custom Logger 22");
|
|
|
|
cus2.log("Hello from custom Logger 2");
|
|
|
|
cus22.log("Hello from custom Logger 22");
|
|
|
|
cus2.log("Hello from custom Logger 2");
|
|
|
|
cus22.log("Hello from custom Logger 22");
|
|
|
|
cus2.log("Hello from custom Logger 2");
|
|
|
|
cus22.log("Hello from custom Logger 22");
|
|
|
|
cus2.log("Hello from custom Logger 2");
|
|
|
|
cus22.log("Hello from custom Logger 22");
|
|
|
|
cus2.log("Hello from custom Logger 2");
|
|
|
|
index_1.Logging.console_out = false;
|
2018-10-05 18:38:33 +00:00
|
|
|
async function benchmark(count, message_size) {
|
|
|
|
await index_1.Logging.waitForSetup();
|
|
|
|
const randData = crypto_1.randomBytes(message_size).toString("hex");
|
|
|
|
const t = process.hrtime();
|
|
|
|
for (let i = 0; i < count; i++) {
|
|
|
|
index_1.Logging.log(randData);
|
|
|
|
}
|
|
|
|
const diff = process.hrtime(t);
|
|
|
|
const NS_PER_SEC = 1e9;
|
|
|
|
await index_1.Logging.waitForSetup();
|
|
|
|
const ns = diff[0] * NS_PER_SEC + diff[1];
|
|
|
|
console.log(`Benchmark took ${ns / 1000000}ms for ${count} messages with a size of ${message_size} characters`);
|
|
|
|
console.log(`This is equal to ${(ns / 1000000) / count} ms per message`);
|
|
|
|
}
|
|
|
|
index_1.Logging.waitForSetup().then(async () => {
|
|
|
|
console.log("Large data benchmark:");
|
|
|
|
await benchmark(7000, 50000);
|
|
|
|
console.log("Realdata data benchmark:");
|
|
|
|
await benchmark(100000, 100);
|
|
|
|
});
|
2017-08-23 14:45:03 +00:00
|
|
|
//# sourceMappingURL=test.js.map
|