@adviser/cement 0.2.34 → 0.2.36

Sign up to get free protection for your applications and to get access to all the features.
package/ts/logger-impl.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import YAML from "yaml";
2
- import { Level, logValue, removeSelfRef, asyncLogValue, } from "./logger.js";
2
+ import { Level, logValue, LogValue, asyncLogValue, } from "./logger.js";
3
3
  import { WebSysAbstraction } from "./web/web-sys-abstraction.js";
4
4
  import { Result } from "./result.js";
5
5
  import { URI } from "./uri.js";
@@ -41,7 +41,14 @@ export class JSONFormatter {
41
41
  this._space = space;
42
42
  }
43
43
  format(attr) {
44
- return this._txtEnDe.encode(JSON.stringify(attr, removeSelfRef(), this._space) + "\n");
44
+ let ret;
45
+ try {
46
+ ret = JSON.stringify(attr, null, this._space);
47
+ }
48
+ catch (e) {
49
+ ret = JSON.stringify({ internal: { message: e.message, stack: e.stack } });
50
+ }
51
+ return this._txtEnDe.encode(ret + "\n");
45
52
  }
46
53
  }
47
54
  export class YAMLFormatter {
@@ -50,7 +57,7 @@ export class YAMLFormatter {
50
57
  this._space = space;
51
58
  }
52
59
  format(attr) {
53
- return this._txtEnDe.encode("---\n" + YAML.stringify(attr, removeSelfRef(), this._space) + "\n");
60
+ return this._txtEnDe.encode("---\n" + YAML.stringify(attr, null, this._space) + "\n");
54
61
  }
55
62
  }
56
63
  export class LoggerImpl {
@@ -119,7 +126,7 @@ export class LoggerImpl {
119
126
  return this._txtEnDe;
120
127
  }
121
128
  Attributes() {
122
- return JSON.parse(JSON.stringify(this._attributes, removeSelfRef()));
129
+ return JSON.parse(JSON.stringify(this._attributes, null));
123
130
  }
124
131
  SetExposeStack(enable) {
125
132
  this._levelHandler.setExposeStack(enable);
@@ -207,7 +214,37 @@ export class LoggerImpl {
207
214
  return this;
208
215
  }
209
216
  Bool(key, value) {
210
- this._attributes[key] = logValue(!!value);
217
+ this.coerceKey(key, !!value);
218
+ return this;
219
+ }
220
+ Http(res, req, key) {
221
+ if (Result.Is(res)) {
222
+ if (res.isErr()) {
223
+ this.Err(res.Err());
224
+ return this;
225
+ }
226
+ res = res.Ok();
227
+ }
228
+ let reqRes = res;
229
+ if (req) {
230
+ reqRes = { res, req };
231
+ }
232
+ this.Any(key || "Http", reqRes);
233
+ return this;
234
+ }
235
+ Pair(x) {
236
+ for (const key of Object.keys(x)) {
237
+ const value = x[key];
238
+ if (value instanceof LogValue) {
239
+ this._attributes[key] = value;
240
+ continue;
241
+ }
242
+ if (Result.Is(value)) {
243
+ this.Result(key, value);
244
+ continue;
245
+ }
246
+ this.Any(key, value);
247
+ }
211
248
  return this;
212
249
  }
213
250
  Result(key, res) {
@@ -231,12 +268,20 @@ export class LoggerImpl {
231
268
  this.Ref(key, () => URI.from(url).toString());
232
269
  return this;
233
270
  }
271
+ coerceKey(key, value) {
272
+ if (typeof key === "string") {
273
+ this._attributes[key] = logValue(value);
274
+ }
275
+ else {
276
+ this.Pair(key);
277
+ }
278
+ }
234
279
  Str(key, value) {
235
- this._attributes[key] = logValue(value);
280
+ this.coerceKey(key, value);
236
281
  return this;
237
282
  }
238
283
  Any(key, value) {
239
- this._attributes[key] = logValue(value);
284
+ this.coerceKey(key, value);
240
285
  return this;
241
286
  }
242
287
  Dur(key, nsec) {
@@ -244,7 +289,7 @@ export class LoggerImpl {
244
289
  return this;
245
290
  }
246
291
  Uint64(key, value) {
247
- this._attributes[key] = logValue(value);
292
+ this.coerceKey(key, value);
248
293
  return this;
249
294
  }
250
295
  Int(key, value) {
@@ -334,6 +379,14 @@ class WithLoggerBuilder {
334
379
  this._li.SetDebug(...modules);
335
380
  return this;
336
381
  }
382
+ Http(res, req, key) {
383
+ this._li.Http(res, req, key);
384
+ return this;
385
+ }
386
+ Pair(x) {
387
+ this._li.Pair(x);
388
+ return this;
389
+ }
337
390
  Str(key, value) {
338
391
  this._li.Str(key, value);
339
392
  return this;
@@ -1 +1 @@
1
- {"version":3,"file":"logger-impl.js","sourceRoot":"","sources":["../../src/logger-impl.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAA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CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,GAAG,CAAC,GAAY;QACd,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI;QACF,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,SAAS;QACP,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,GAAG,CAAC,GAAqC,EAAE,KAAiC;QAC1E,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,GAAG,CAAC,GAAW,EAAE,IAAY;QAC3B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,CAAC,GAAoC,EAAE,KAAc;QACzD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
package/ts/logger.d.ts CHANGED
@@ -16,7 +16,6 @@ export declare class LogValue {
16
16
  toJSON(): Serialized | Serialized[];
17
17
  }
18
18
  export type LogSerializable = Record<string, LogValue | Promise<LogValue>>;
19
- export declare function removeSelfRef(lineEnd?: string): (key: unknown, val: unknown) => unknown;
20
19
  export declare function asyncLogValue(val: () => Promise<Serialized>): Promise<LogValue>;
21
20
  export type LogValueArg = LogValue | Serialized | Serialized[] | FnSerialized | undefined | null;
22
21
  export declare function logValue(val: LogValueArg, state?: Set<unknown>): LogValue;
@@ -54,7 +53,13 @@ export interface LoggerInterface<R> {
54
53
  Url(url: CoerceURI, key?: string): R;
55
54
  Len(value: unknown, key?: string): R;
56
55
  Hash(value: unknown, key?: string): R;
57
- Str(key: string, value?: string): R;
56
+ Str<T extends string | Record<string, string>>(key: T, value?: T extends string ? string : undefined): R;
57
+ Uint64<T extends string | Record<string, number>>(key: T, value?: T extends string ? number : undefined): R;
58
+ Int<T extends string | Record<string, number>>(key: T, value?: T extends string ? number : undefined): R;
59
+ Bool<T extends string | Record<string, unknown>>(key: T, value?: T extends string ? unknown : undefined): R;
60
+ Any<T extends string | Record<string, unknown>>(key: T, value?: T extends string ? unknown : undefined): R;
61
+ Http(res: Response | Result<Response>, req?: Request, key?: string): R;
62
+ Pair(x: Record<string, unknown>): R;
58
63
  Error(): R;
59
64
  Warn(): R;
60
65
  Debug(): R;
@@ -63,11 +68,7 @@ export interface LoggerInterface<R> {
63
68
  Err(err: unknown | Result<unknown> | Error): R;
64
69
  Info(): R;
65
70
  Timestamp(): R;
66
- Any(key: string, value: unknown): R;
67
71
  Dur(key: string, nsec: number): R;
68
- Uint64(key: string, value: number): R;
69
- Int(key: string, value: number): R;
70
- Bool(key: string, value: unknown): R;
71
72
  }
72
73
  export declare function IsLogger(obj: unknown): obj is Logger;
73
74
  export interface WithLogger extends LoggerInterface<WithLogger> {
@@ -1 +1 @@
1
- {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,oBAAY,KAAK;IACf,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACnD,MAAM,MAAM,YAAY,GAAG,MAAM,UAAU,GAAG,UAAU,EAAE,CAAC;AAE3D,qBAAa,QAAQ;IACP,QAAQ,CAAC,EAAE,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IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAChC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB"}
package/ts/logger.js CHANGED
@@ -11,23 +11,17 @@ export class LogValue {
11
11
  this.fn = fn;
12
12
  }
13
13
  value() {
14
- return this.fn();
14
+ try {
15
+ return this.fn();
16
+ }
17
+ catch (e) {
18
+ return `LogValue:${e.message}`;
19
+ }
15
20
  }
16
21
  toJSON() {
17
22
  return this.value();
18
23
  }
19
24
  }
20
- export function removeSelfRef(lineEnd) {
21
- const cache = new Set();
22
- return function (key, value) {
23
- if (typeof value === "object" && value !== null) {
24
- if (cache.has(value))
25
- return "...";
26
- cache.add(value);
27
- }
28
- return lineEnd ? value + lineEnd : value;
29
- };
30
- }
31
25
  export function asyncLogValue(val) {
32
26
  throw new Error("Not implemented");
33
27
  }
@@ -55,19 +49,31 @@ export function logValue(val, state = new Set([Math.random()])) {
55
49
  case "boolean":
56
50
  return new LogValue(() => val);
57
51
  case "object": {
52
+ if (val === null) {
53
+ return new LogValue(() => "null");
54
+ }
58
55
  if (ArrayBuffer.isView(val)) {
59
56
  return logValue(bin2string(val, 512));
60
57
  }
61
58
  if (Array.isArray(val)) {
62
59
  return new LogValue(() => val.map((v) => logValue(v).value()));
63
60
  }
64
- if (val === null) {
65
- return new LogValue(() => "null");
61
+ if (val instanceof Headers) {
62
+ return new LogValue(() => Object.fromEntries(val.entries()));
63
+ }
64
+ if (val instanceof ReadableStream) {
65
+ return new LogValue(() => ">Stream<");
66
+ }
67
+ if (val instanceof Promise) {
68
+ return new LogValue(() => ">Promise<");
66
69
  }
67
70
  if (state.has(val)) {
68
71
  return new LogValue(() => "...");
69
72
  }
70
73
  state.add(val);
74
+ if (typeof val.toJSON === "function") {
75
+ return new LogValue(() => val.toJSON());
76
+ }
71
77
  const res = {};
72
78
  const typedVal = val;
73
79
  for (const key in typedVal) {
@@ -76,7 +82,9 @@ export function logValue(val, state = new Set([Math.random()])) {
76
82
  res[key] = element;
77
83
  }
78
84
  else {
79
- res[key] = logValue(element, state);
85
+ if (typeof element !== "function") {
86
+ res[key] = logValue(element, state);
87
+ }
80
88
  }
81
89
  }
82
90
  return new LogValue(() => res);
package/ts/logger.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAK3C,MAAM,CAAN,IAAY,KAKX;AALD,WAAY,KAAK;IACf,sBAAa,CAAA;IACb,wBAAe,CAAA;IACf,sBAAa,CAAA;IACb,wBAAe,CAAA;AACjB,CAAC,EALW,KAAK,KAAL,KAAK,QAKhB;AAKD,MAAM,OAAO,QAAQ;IACnB,YAAqB,EAAgB;QAAhB,OAAE,GAAF,EAAE,CAAc;IAAG,CAAC;IACzC,KAAK;QACH,OAAO,IAAI,CAAC,EAAE,EAAE,CAAC;IACnB,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF;AAID,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;IACxB,OAAO,UAAU,GAAY,EAAE,KAAc;QAC3C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YAEhD,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC;gBAAE,OAAO,KAAK,CAAC;YACnC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;QACD,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC;AAGD,MAAM,UAAU,aAAa,CAAC,GAA8B;IAE1D,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;AACrC,CAAC;AAID,MAAM,UAAU,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,CAAC,GAAG,CAAC,CAAC;gBAC9B,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;oBAChC,GAAG,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC;gBACrB,CAAC;qBAAM,CAAC;oBACN,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;wBAClC,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;oBACtC,CAAC;gBAEH,CAAC;YACH,CAAC;YAED,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC,GAA4B,CAAC,CAAC;QAC1D,CAAC;QACD;YACE,IAAI,CAAC,GAAG,EAAE,CAAC;gBACT,OAAO,IAAI,QAAQ,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC;YACzC,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,gBAAgB,OAAO,GAAG,EAAE,CAAC,CAAC;IAClD,CAAC;AACH,CAAC;AAkED,MAAM,UAAU,QAAQ,CAAC,GAAY;IACnC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB;YACE,QAAQ;YACR,aAAa;YACb,cAAc;YACd,UAAU;YACV,KAAK;YACL,OAAO;YACP,MAAM;YACN,OAAO;YACP,KAAK;YACL,WAAW;YACX,KAAK;YACL,MAAM;YACN,WAAW;YACX,KAAK;YACL,KAAK;YACL,QAAQ;SACT;aAEE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,OAAQ,GAAW,CAAC,EAAE,CAAC,KAAK,UAAU,CAAC;aACnD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAClC,CAAC;AACJ,CAAC"}
package/ts/logger.test.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { TimeFactory, IsLogger, Level, LevelHandlerImpl, LogCollector, LoggerImpl, logValue, Result, runtimeFn, TimeMode, BuildURI, URI, MutableURL, JSONFormatter, YAMLFormatter, } from "@adviser/cement";
2
2
  import { WebSysAbstraction } from "@adviser/cement/web";
3
+ import { stripper } from "./utils/stripper.js";
3
4
  describe("TestLogger", () => {
4
5
  let logCollector;
5
6
  let logger;
@@ -986,6 +987,36 @@ describe("TestLogger", () => {
986
987
  expect(res.isErr()).toBeTruthy();
987
988
  expect(res.Err().message).toBe('{"level":"error","msg":"AsError"}\n');
988
989
  });
990
+ it("receive object", async () => {
991
+ logger
992
+ .Error()
993
+ .Str({ blaStr: "blub", blaStr2: "blub2" })
994
+ .Uint64({ blaUint64: 65, blaUint642: 66 })
995
+ .Int({ blaInt: 65 })
996
+ .Bool({ blaBool: true, blaBool2: false })
997
+ .Any({ blaAny: { a: 1 }, blaAny2: { b: 2 } })
998
+ .Msg("hello");
999
+ await logger.Flush();
1000
+ expect(logCollector.Logs()).toEqual([
1001
+ {
1002
+ blaAny: {
1003
+ a: 1,
1004
+ },
1005
+ blaAny2: {
1006
+ b: 2,
1007
+ },
1008
+ blaBool: true,
1009
+ blaBool2: false,
1010
+ blaInt: 65,
1011
+ blaStr: "blub",
1012
+ blaStr2: "blub2",
1013
+ blaUint64: 65,
1014
+ blaUint642: 66,
1015
+ level: "error",
1016
+ msg: "hello",
1017
+ },
1018
+ ]);
1019
+ });
989
1020
  it("my own yaml formatter", async () => {
990
1021
  const log = logger.SetExposeStack(true).SetFormatter(new YAMLFormatter(logger.TxtEnDe(), 2)).With().Logger();
991
1022
  log
@@ -1033,5 +1064,179 @@ describe("TestLogger", () => {
1033
1064
  "msg: hello",
1034
1065
  ]);
1035
1066
  });
1067
+ it("Pairing", async () => {
1068
+ logger
1069
+ .Error()
1070
+ .Pair({
1071
+ str: "blub",
1072
+ int: 4711,
1073
+ bool: true,
1074
+ resultOk: Result.Ok({ a: 1 }),
1075
+ resultErr: Result.Err("Error"),
1076
+ uint8: new Uint8Array([1, 2, 3]),
1077
+ obj: { a: 1 },
1078
+ arr: [1, 2, 3],
1079
+ })
1080
+ .Msg("1");
1081
+ await logger.Flush();
1082
+ expect(logCollector.Logs(true)).toEqual([
1083
+ JSON.stringify({
1084
+ level: "error",
1085
+ str: "blub",
1086
+ int: 4711,
1087
+ bool: true,
1088
+ resultOk: { a: 1 },
1089
+ error: "Error",
1090
+ uint8: "0000 01 02 03 ...",
1091
+ obj: { a: 1 },
1092
+ arr: [1, 2, 3],
1093
+ msg: "1",
1094
+ }),
1095
+ ]);
1096
+ });
1097
+ it("fetch-formatter", async () => {
1098
+ const result = new Response("body", {
1099
+ status: 200,
1100
+ statusText: "OK",
1101
+ headers: new Headers({
1102
+ "Content-Type": "text/html",
1103
+ "X-Test": "test",
1104
+ }),
1105
+ });
1106
+ logger.Error().Any("res", { the: result }).Msg("ok");
1107
+ logger.Error().Http(Result.Ok(result)).Msg("1");
1108
+ const req = new Request("https://www.google.com", {
1109
+ method: "PUT",
1110
+ headers: new Headers({
1111
+ "Content-Type": "text/html",
1112
+ "X-Test": "xtest",
1113
+ }),
1114
+ });
1115
+ logger.Error().Http(result, req, "Https").Msg("1");
1116
+ await logger.Flush();
1117
+ expect(stripper(["isReloadNavigation", "reason", "targetAddressSpace", "attribute", "duplex"], logCollector.Logs(true).map((i) => JSON.parse(i)))).toEqual([
1118
+ {
1119
+ level: "error",
1120
+ res: {
1121
+ the: {
1122
+ type: "default",
1123
+ url: "",
1124
+ redirected: false,
1125
+ status: 200,
1126
+ ok: true,
1127
+ statusText: "OK",
1128
+ headers: {
1129
+ "content-type": "text/html",
1130
+ "x-test": "test",
1131
+ },
1132
+ body: ">Stream<",
1133
+ bodyUsed: false,
1134
+ },
1135
+ },
1136
+ msg: "ok",
1137
+ },
1138
+ {
1139
+ level: "error",
1140
+ Http: {
1141
+ type: "default",
1142
+ url: "",
1143
+ redirected: false,
1144
+ status: 200,
1145
+ ok: true,
1146
+ statusText: "OK",
1147
+ headers: {
1148
+ "content-type": "text/html",
1149
+ "x-test": "test",
1150
+ },
1151
+ body: ">Stream<",
1152
+ bodyUsed: false,
1153
+ },
1154
+ msg: "1",
1155
+ },
1156
+ {
1157
+ level: "error",
1158
+ Https: {
1159
+ res: {
1160
+ type: "default",
1161
+ url: "",
1162
+ redirected: false,
1163
+ status: 200,
1164
+ ok: true,
1165
+ statusText: "OK",
1166
+ headers: {
1167
+ "content-type": "text/html",
1168
+ "x-test": "test",
1169
+ },
1170
+ body: ">Stream<",
1171
+ bodyUsed: false,
1172
+ },
1173
+ req: {
1174
+ method: "PUT",
1175
+ url: "https://www.google.com/",
1176
+ headers: {
1177
+ "content-type": "text/html",
1178
+ "x-test": "xtest",
1179
+ },
1180
+ destination: "",
1181
+ referrer: "about:client",
1182
+ referrerPolicy: "",
1183
+ mode: "cors",
1184
+ credentials: "same-origin",
1185
+ cache: "default",
1186
+ redirect: "follow",
1187
+ integrity: "",
1188
+ keepalive: false,
1189
+ isHistoryNavigation: false,
1190
+ signal: {
1191
+ aborted: false,
1192
+ onabort: "null",
1193
+ },
1194
+ body: "null",
1195
+ bodyUsed: false,
1196
+ },
1197
+ },
1198
+ msg: "1",
1199
+ },
1200
+ ]);
1201
+ });
1202
+ it("use toJSON", async () => {
1203
+ logger
1204
+ .Error()
1205
+ .Any("res", { uri: URI.from("https://doof.de?x=4&a=b") })
1206
+ .Msg("ok");
1207
+ await logger.Flush();
1208
+ expect(logCollector.Logs(true)).toEqual([
1209
+ {
1210
+ level: "error",
1211
+ res: {
1212
+ uri: "https://doof.de/?a=b&x=4",
1213
+ },
1214
+ msg: "ok",
1215
+ },
1216
+ ].map((i) => JSON.stringify(i)));
1217
+ });
1218
+ class Test {
1219
+ constructor(a, b) {
1220
+ this.a = a;
1221
+ this.b = b;
1222
+ }
1223
+ toJSON() {
1224
+ throw new Error("test");
1225
+ }
1226
+ }
1227
+ it("throw in toString", async () => {
1228
+ logger
1229
+ .Error()
1230
+ .Any("res", new Test(1, URI.from("https://doof.de")))
1231
+ .Msg("ok");
1232
+ await logger.Flush();
1233
+ expect(logCollector.Logs(true)).toEqual([
1234
+ {
1235
+ level: "error",
1236
+ res: "LogValue:test",
1237
+ msg: "ok",
1238
+ },
1239
+ ].map((i) => JSON.stringify(i)));
1240
+ });
1036
1241
  });
1037
1242
  //# sourceMappingURL=logger.test.js.map