@adviser/cement 0.0.0-jsr-t1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (320) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +39 -0
  3. package/base-sys-abstraction-BkEiLHl0.d.ts +193 -0
  4. package/base-sys-abstraction-Qj7pkY1N.d.cts +193 -0
  5. package/chunk-7KFVMTOS.js +311 -0
  6. package/chunk-7KFVMTOS.js.map +1 -0
  7. package/chunk-GES3MUGV.js +92 -0
  8. package/chunk-GES3MUGV.js.map +1 -0
  9. package/chunk-Q65HLCNL.js +601 -0
  10. package/chunk-Q65HLCNL.js.map +1 -0
  11. package/chunk-WMMUXBDX.js +87 -0
  12. package/chunk-WMMUXBDX.js.map +1 -0
  13. package/index-Q3phXzYr.d.cts +75 -0
  14. package/index-tIGZMHTc.d.ts +75 -0
  15. package/index.cjs +2593 -0
  16. package/index.cjs.map +1 -0
  17. package/index.d.cts +532 -0
  18. package/index.d.ts +532 -0
  19. package/index.js +1533 -0
  20. package/index.js.map +1 -0
  21. package/node/index.cjs +924 -0
  22. package/node/index.cjs.map +1 -0
  23. package/node/index.d.cts +65 -0
  24. package/node/index.d.ts +65 -0
  25. package/node/index.js +398 -0
  26. package/node/index.js.map +1 -0
  27. package/package.json +81 -0
  28. package/src/base-sys-abstraction.test.ts +95 -0
  29. package/src/base-sys-abstraction.ts +242 -0
  30. package/src/bin2text.test.ts +59 -0
  31. package/src/bin2text.ts +47 -0
  32. package/src/crypto.test.ts +15 -0
  33. package/src/crypto.ts +125 -0
  34. package/src/file-service.ts +24 -0
  35. package/src/future.test.ts +32 -0
  36. package/src/future.ts +27 -0
  37. package/src/index.ts +22 -0
  38. package/src/jsr.json +20 -0
  39. package/src/log-level-impl.ts +87 -0
  40. package/src/log-writer-impl.ts +58 -0
  41. package/src/logger-impl.ts +498 -0
  42. package/src/logger.test.ts +1132 -0
  43. package/src/logger.ts +208 -0
  44. package/src/node/deno-file-service.ts +92 -0
  45. package/src/node/deno-sys-abstraction.ts +133 -0
  46. package/src/node/index.ts +4 -0
  47. package/src/node/mock-file-service.ts +45 -0
  48. package/src/node/node-file-service.ts +91 -0
  49. package/src/node/node-sys-abstraction.ts +121 -0
  50. package/src/option.ts +60 -0
  51. package/src/resolve-once.test.ts +321 -0
  52. package/src/resolve-once.ts +179 -0
  53. package/src/result.test.ts +102 -0
  54. package/src/result.ts +165 -0
  55. package/src/runtime.ts +36 -0
  56. package/src/sys-abstraction.ts +53 -0
  57. package/src/sys-env.test.ts +53 -0
  58. package/src/sys-env.ts +216 -0
  59. package/src/test/log-write-stream.ts +95 -0
  60. package/src/test/mock-logger.ts +40 -0
  61. package/src/time.ts +20 -0
  62. package/src/tracer.test.ts +314 -0
  63. package/src/tracer.ts +222 -0
  64. package/src/txt-en-decoder.ts +21 -0
  65. package/src/uri.test.ts +155 -0
  66. package/src/uri.ts +421 -0
  67. package/src/utils/console-write-stream.ts +72 -0
  68. package/src/utils/fanout-write-stream.ts +32 -0
  69. package/src/utils/index.ts +6 -0
  70. package/src/utils/rebuffer.ts +75 -0
  71. package/src/utils/stream-map.ts +67 -0
  72. package/src/utils/stream2string.ts +47 -0
  73. package/src/utils/string2stream.ts +14 -0
  74. package/src/version.ts +3 -0
  75. package/src/web/index.ts +1 -0
  76. package/src/web/web-sys-abstraction.ts +80 -0
  77. package/ts/LICENSE +201 -0
  78. package/ts/README.md +39 -0
  79. package/ts/base-sys-abstraction.d.ts +84 -0
  80. package/ts/base-sys-abstraction.d.ts.map +1 -0
  81. package/ts/base-sys-abstraction.js +178 -0
  82. package/ts/base-sys-abstraction.js.map +1 -0
  83. package/ts/base-sys-abstraction.test.d.ts +2 -0
  84. package/ts/base-sys-abstraction.test.d.ts.map +1 -0
  85. package/ts/base-sys-abstraction.test.js +82 -0
  86. package/ts/base-sys-abstraction.test.js.map +1 -0
  87. package/ts/bin2text.d.ts +3 -0
  88. package/ts/bin2text.d.ts.map +1 -0
  89. package/ts/bin2text.js +43 -0
  90. package/ts/bin2text.js.map +1 -0
  91. package/ts/bin2text.test.d.ts +2 -0
  92. package/ts/bin2text.test.d.ts.map +1 -0
  93. package/ts/bin2text.test.js +51 -0
  94. package/ts/bin2text.test.js.map +1 -0
  95. package/ts/crypto.d.ts +76 -0
  96. package/ts/crypto.d.ts.map +1 -0
  97. package/ts/crypto.js +22 -0
  98. package/ts/crypto.js.map +1 -0
  99. package/ts/crypto.test.d.ts +2 -0
  100. package/ts/crypto.test.d.ts.map +1 -0
  101. package/ts/crypto.test.js +14 -0
  102. package/ts/crypto.test.js.map +1 -0
  103. package/ts/file-service.d.ts +17 -0
  104. package/ts/file-service.d.ts.map +1 -0
  105. package/ts/file-service.js +2 -0
  106. package/ts/file-service.js.map +1 -0
  107. package/ts/future.d.ts +8 -0
  108. package/ts/future.d.ts.map +1 -0
  109. package/ts/future.js +38 -0
  110. package/ts/future.js.map +1 -0
  111. package/ts/future.test.d.ts +2 -0
  112. package/ts/future.test.d.ts.map +1 -0
  113. package/ts/future.test.js +28 -0
  114. package/ts/future.test.js.map +1 -0
  115. package/ts/index.d.ts +23 -0
  116. package/ts/index.d.ts.map +1 -0
  117. package/ts/index.js +23 -0
  118. package/ts/index.js.map +1 -0
  119. package/ts/log-level-impl.d.ts +14 -0
  120. package/ts/log-level-impl.d.ts.map +1 -0
  121. package/ts/log-level-impl.js +72 -0
  122. package/ts/log-level-impl.js.map +1 -0
  123. package/ts/log-writer-impl.d.ts +10 -0
  124. package/ts/log-writer-impl.d.ts.map +1 -0
  125. package/ts/log-writer-impl.js +45 -0
  126. package/ts/log-writer-impl.js.map +1 -0
  127. package/ts/logger-impl.d.ts +71 -0
  128. package/ts/logger-impl.d.ts.map +1 -0
  129. package/ts/logger-impl.js +412 -0
  130. package/ts/logger-impl.js.map +1 -0
  131. package/ts/logger.d.ts +84 -0
  132. package/ts/logger.d.ts.map +1 -0
  133. package/ts/logger.js +114 -0
  134. package/ts/logger.js.map +1 -0
  135. package/ts/logger.test.d.ts +2 -0
  136. package/ts/logger.test.d.ts.map +1 -0
  137. package/ts/logger.test.js +1023 -0
  138. package/ts/logger.test.js.map +1 -0
  139. package/ts/node/deno-file-service.d.ts +17 -0
  140. package/ts/node/deno-file-service.d.ts.map +1 -0
  141. package/ts/node/deno-file-service.js +65 -0
  142. package/ts/node/deno-file-service.js.map +1 -0
  143. package/ts/node/deno-sys-abstraction.d.ts +22 -0
  144. package/ts/node/deno-sys-abstraction.d.ts.map +1 -0
  145. package/ts/node/deno-sys-abstraction.js +101 -0
  146. package/ts/node/deno-sys-abstraction.js.map +1 -0
  147. package/ts/node/index.d.ts +5 -0
  148. package/ts/node/index.d.ts.map +1 -0
  149. package/ts/node/index.js +5 -0
  150. package/ts/node/index.js.map +1 -0
  151. package/ts/node/mock-file-service.d.ts +11 -0
  152. package/ts/node/mock-file-service.d.ts.map +1 -0
  153. package/ts/node/mock-file-service.js +34 -0
  154. package/ts/node/mock-file-service.js.map +1 -0
  155. package/ts/node/mock-file-service.test.d.ts +2 -0
  156. package/ts/node/mock-file-service.test.d.ts.map +1 -0
  157. package/ts/node/mock-file-service.test.js +31 -0
  158. package/ts/node/mock-file-service.test.js.map +1 -0
  159. package/ts/node/node-file-service.d.ts +16 -0
  160. package/ts/node/node-file-service.d.ts.map +1 -0
  161. package/ts/node/node-file-service.js +71 -0
  162. package/ts/node/node-file-service.js.map +1 -0
  163. package/ts/node/node-sys-abstraction.d.ts +22 -0
  164. package/ts/node/node-sys-abstraction.d.ts.map +1 -0
  165. package/ts/node/node-sys-abstraction.js +99 -0
  166. package/ts/node/node-sys-abstraction.js.map +1 -0
  167. package/ts/node/node-sys-abstraction.test.d.ts +2 -0
  168. package/ts/node/node-sys-abstraction.test.d.ts.map +1 -0
  169. package/ts/node/node-sys-abstraction.test.js +87 -0
  170. package/ts/node/node-sys-abstraction.test.js.map +1 -0
  171. package/ts/option.d.ts +25 -0
  172. package/ts/option.d.ts.map +1 -0
  173. package/ts/option.js +47 -0
  174. package/ts/option.js.map +1 -0
  175. package/ts/resolve-once.d.ts +46 -0
  176. package/ts/resolve-once.d.ts.map +1 -0
  177. package/ts/resolve-once.js +152 -0
  178. package/ts/resolve-once.js.map +1 -0
  179. package/ts/resolve-once.test.d.ts +2 -0
  180. package/ts/resolve-once.test.d.ts.map +1 -0
  181. package/ts/resolve-once.test.js +283 -0
  182. package/ts/resolve-once.test.js.map +1 -0
  183. package/ts/result.d.ts +34 -0
  184. package/ts/result.d.ts.map +1 -0
  185. package/ts/result.js +85 -0
  186. package/ts/result.js.map +1 -0
  187. package/ts/result.test.d.ts +2 -0
  188. package/ts/result.test.d.ts.map +1 -0
  189. package/ts/result.test.js +79 -0
  190. package/ts/result.test.js.map +1 -0
  191. package/ts/runtime.d.ts +8 -0
  192. package/ts/runtime.d.ts.map +1 -0
  193. package/ts/runtime.js +26 -0
  194. package/ts/runtime.js.map +1 -0
  195. package/ts/sys-abstraction.d.ts +36 -0
  196. package/ts/sys-abstraction.d.ts.map +1 -0
  197. package/ts/sys-abstraction.js +31 -0
  198. package/ts/sys-abstraction.js.map +1 -0
  199. package/ts/sys-env.d.ts +48 -0
  200. package/ts/sys-env.d.ts.map +1 -0
  201. package/ts/sys-env.js +176 -0
  202. package/ts/sys-env.js.map +1 -0
  203. package/ts/sys-env.test.d.ts +2 -0
  204. package/ts/sys-env.test.d.ts.map +1 -0
  205. package/ts/sys-env.test.js +51 -0
  206. package/ts/sys-env.test.js.map +1 -0
  207. package/ts/test/log-write-stream.d.ts +27 -0
  208. package/ts/test/log-write-stream.d.ts.map +1 -0
  209. package/ts/test/log-write-stream.js +74 -0
  210. package/ts/test/log-write-stream.js.map +1 -0
  211. package/ts/test/mock-logger.d.ts +14 -0
  212. package/ts/test/mock-logger.d.ts.map +1 -0
  213. package/ts/test/mock-logger.js +29 -0
  214. package/ts/test/mock-logger.js.map +1 -0
  215. package/ts/test/mock-logger.test.d.ts +2 -0
  216. package/ts/test/mock-logger.test.d.ts.map +1 -0
  217. package/ts/test/mock-logger.test.js +63 -0
  218. package/ts/test/mock-logger.test.js.map +1 -0
  219. package/ts/test/test-exit-handler.d.ts +2 -0
  220. package/ts/test/test-exit-handler.d.ts.map +1 -0
  221. package/ts/test/test-exit-handler.js +57 -0
  222. package/ts/test/test-exit-handler.js.map +1 -0
  223. package/ts/time.d.ts +13 -0
  224. package/ts/time.d.ts.map +1 -0
  225. package/ts/time.js +14 -0
  226. package/ts/time.js.map +1 -0
  227. package/ts/tracer.d.ts +59 -0
  228. package/ts/tracer.d.ts.map +1 -0
  229. package/ts/tracer.js +148 -0
  230. package/ts/tracer.js.map +1 -0
  231. package/ts/tracer.test.d.ts +2 -0
  232. package/ts/tracer.test.d.ts.map +1 -0
  233. package/ts/tracer.test.js +311 -0
  234. package/ts/tracer.test.js.map +1 -0
  235. package/ts/txt-en-decoder.d.ts +10 -0
  236. package/ts/txt-en-decoder.d.ts.map +1 -0
  237. package/ts/txt-en-decoder.js +15 -0
  238. package/ts/txt-en-decoder.js.map +1 -0
  239. package/ts/uri.d.ts +67 -0
  240. package/ts/uri.d.ts.map +1 -0
  241. package/ts/uri.js +283 -0
  242. package/ts/uri.js.map +1 -0
  243. package/ts/uri.test.d.ts +2 -0
  244. package/ts/uri.test.d.ts.map +1 -0
  245. package/ts/uri.test.js +119 -0
  246. package/ts/uri.test.js.map +1 -0
  247. package/ts/utils/console-write-stream.d.ts +21 -0
  248. package/ts/utils/console-write-stream.d.ts.map +1 -0
  249. package/ts/utils/console-write-stream.js +62 -0
  250. package/ts/utils/console-write-stream.js.map +1 -0
  251. package/ts/utils/fanout-write-stream.d.ts +12 -0
  252. package/ts/utils/fanout-write-stream.d.ts.map +1 -0
  253. package/ts/utils/fanout-write-stream.js +24 -0
  254. package/ts/utils/fanout-write-stream.js.map +1 -0
  255. package/ts/utils/index.d.ts +7 -0
  256. package/ts/utils/index.d.ts.map +1 -0
  257. package/ts/utils/index.js +7 -0
  258. package/ts/utils/index.js.map +1 -0
  259. package/ts/utils/rebuffer.d.ts +3 -0
  260. package/ts/utils/rebuffer.d.ts.map +1 -0
  261. package/ts/utils/rebuffer.js +60 -0
  262. package/ts/utils/rebuffer.js.map +1 -0
  263. package/ts/utils/rebuffer.test.d.ts +2 -0
  264. package/ts/utils/rebuffer.test.d.ts.map +1 -0
  265. package/ts/utils/rebuffer.test.js +77 -0
  266. package/ts/utils/rebuffer.test.js.map +1 -0
  267. package/ts/utils/stream-map.d.ts +9 -0
  268. package/ts/utils/stream-map.d.ts.map +1 -0
  269. package/ts/utils/stream-map.js +62 -0
  270. package/ts/utils/stream-map.js.map +1 -0
  271. package/ts/utils/stream-map.test.d.ts +2 -0
  272. package/ts/utils/stream-map.test.d.ts.map +1 -0
  273. package/ts/utils/stream-map.test.js +87 -0
  274. package/ts/utils/stream-map.test.js.map +1 -0
  275. package/ts/utils/stream-test-helper.d.ts +17 -0
  276. package/ts/utils/stream-test-helper.d.ts.map +1 -0
  277. package/ts/utils/stream-test-helper.js +37 -0
  278. package/ts/utils/stream-test-helper.js.map +1 -0
  279. package/ts/utils/stream2string.d.ts +3 -0
  280. package/ts/utils/stream2string.d.ts.map +1 -0
  281. package/ts/utils/stream2string.js +48 -0
  282. package/ts/utils/stream2string.js.map +1 -0
  283. package/ts/utils/stream2string.test.d.ts +2 -0
  284. package/ts/utils/stream2string.test.d.ts.map +1 -0
  285. package/ts/utils/stream2string.test.js +29 -0
  286. package/ts/utils/stream2string.test.js.map +1 -0
  287. package/ts/utils/string2stream.d.ts +4 -0
  288. package/ts/utils/string2stream.d.ts.map +1 -0
  289. package/ts/utils/string2stream.js +13 -0
  290. package/ts/utils/string2stream.js.map +1 -0
  291. package/ts/utils/string2stream.test.d.ts +2 -0
  292. package/ts/utils/string2stream.test.d.ts.map +1 -0
  293. package/ts/utils/string2stream.test.js +6 -0
  294. package/ts/utils/string2stream.test.js.map +1 -0
  295. package/ts/version.d.ts +2 -0
  296. package/ts/version.d.ts.map +1 -0
  297. package/ts/version.js +4 -0
  298. package/ts/version.js.map +1 -0
  299. package/ts/web/index.d.ts +2 -0
  300. package/ts/web/index.d.ts.map +1 -0
  301. package/ts/web/index.js +2 -0
  302. package/ts/web/index.js.map +1 -0
  303. package/ts/web/web-sys-abstraction.d.ts +4 -0
  304. package/ts/web/web-sys-abstraction.d.ts.map +1 -0
  305. package/ts/web/web-sys-abstraction.js +64 -0
  306. package/ts/web/web-sys-abstraction.js.map +1 -0
  307. package/txt-en-decoder-CZYJUju2.d.cts +11 -0
  308. package/txt-en-decoder-CZYJUju2.d.ts +11 -0
  309. package/utils/index.cjs +341 -0
  310. package/utils/index.cjs.map +1 -0
  311. package/utils/index.d.cts +2 -0
  312. package/utils/index.d.ts +2 -0
  313. package/utils/index.js +32 -0
  314. package/utils/index.js.map +1 -0
  315. package/web/index.cjs +593 -0
  316. package/web/index.cjs.map +1 -0
  317. package/web/index.d.cts +6 -0
  318. package/web/index.d.ts +6 -0
  319. package/web/index.js +9 -0
  320. package/web/index.js.map +1 -0
@@ -0,0 +1,72 @@
1
+ import { Level } from "./logger.js";
2
+ export class LevelHandlerImpl {
3
+ constructor() {
4
+ this._globalLevels = new Set([Level.INFO, Level.ERROR, Level.WARN]);
5
+ this._modules = new Map();
6
+ this.isStackExposed = false;
7
+ }
8
+ enableLevel(level, ...modules) {
9
+ if (modules.length == 0) {
10
+ this._globalLevels.add(level);
11
+ return;
12
+ }
13
+ this.forModules(level, (p) => {
14
+ this._modules.set(p, new Set([...this._globalLevels, level]));
15
+ }, ...modules);
16
+ }
17
+ disableLevel(level, ...modules) {
18
+ if (modules.length == 0) {
19
+ this._globalLevels.delete(level);
20
+ return;
21
+ }
22
+ this.forModules(level, (p) => {
23
+ this._modules.delete(p);
24
+ }, ...modules);
25
+ }
26
+ setExposeStack(enable) {
27
+ this.isStackExposed = !!enable;
28
+ }
29
+ forModules(level, fnAction, ...modules) {
30
+ for (const m of modules.flat()) {
31
+ if (typeof m !== "string") {
32
+ continue;
33
+ }
34
+ const parts = m
35
+ .split(",")
36
+ .map((s) => s.trim())
37
+ .filter((s) => s.length);
38
+ for (const p of parts) {
39
+ fnAction(p);
40
+ }
41
+ }
42
+ }
43
+ setDebug(...modules) {
44
+ this.forModules(Level.DEBUG, (p) => {
45
+ this._modules.set(p, new Set([...this._globalLevels, Level.DEBUG]));
46
+ }, ...modules);
47
+ }
48
+ isEnabled(ilevel, module) {
49
+ const level = ilevel;
50
+ if (typeof module === "string") {
51
+ const levels = this._modules.get(module);
52
+ if (levels && levels.has(level)) {
53
+ return true;
54
+ }
55
+ }
56
+ const wlevel = this._modules.get("*");
57
+ if (wlevel && typeof level === "string") {
58
+ if (wlevel.has(level)) {
59
+ return true;
60
+ }
61
+ }
62
+ if (typeof level !== "string") {
63
+ return true;
64
+ }
65
+ return this._globalLevels.has(level);
66
+ }
67
+ }
68
+ const levelSingleton = new LevelHandlerImpl();
69
+ export function LevelHandlerSingleton() {
70
+ return levelSingleton;
71
+ }
72
+ //# sourceMappingURL=log-level-impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-level-impl.js","sourceRoot":"","sources":["../../src/log-level-impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,OAAO,gBAAgB;IAA7B;QACW,kBAAa,GAAe,IAAI,GAAG,CAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAClF,aAAQ,GAA4B,IAAI,GAAG,EAAsB,CAAC;QAC3E,mBAAc,GAAG,KAAK,CAAC;IA2EzB,CAAC;IA1EC,WAAW,CAAC,KAAY,EAAE,GAAG,OAAiB;QAC5C,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC9B,OAAO;QACT,CAAC;QACD,IAAI,CAAC,UAAU,CACb,KAAK,EACL,CAAC,CAAC,EAAE,EAAE;YACJ,IAAI,CAAC,QAAQ,CAAC,GAA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AC,EAAE,EAAE;YACJ,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACtE,CAAC,EACD,GAAG,OAAO,CACX,CAAC;IACJ,CAAC;IACD,SAAS,CAAC,MAAe,EAAE,MAAe;QACxC,MAAM,KAAK,GAAG,MAAe,CAAC;QAC9B,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACzC,IAAI,MAAM,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,MAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YACxC,IAAI,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;YAE9B,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;CACF;AAED,MAAM,cAAc,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAE9C,MAAM,UAAU,qBAAqB;IACnC,OAAO,cAAc,CAAC;AACxB,CAAC"}
@@ -0,0 +1,10 @@
1
+ export declare class LogWriterStream {
2
+ readonly _out: WritableStream<Uint8Array>;
3
+ readonly _toFlush: (() => Promise<void>)[];
4
+ constructor(out: WritableStream<Uint8Array>);
5
+ write(encoded: Uint8Array): void;
6
+ _flushIsRunning: boolean;
7
+ _flushDoneFns: (() => void)[];
8
+ _flush(toFlush?: (() => Promise<void>)[] | undefined, done?: () => void): void;
9
+ }
10
+ //# sourceMappingURL=log-writer-impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-writer-impl.d.ts","sourceRoot":"","sources":["../../src/log-writer-impl.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAe;IAC1B,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAM;gBAEpC,GAAG,EAAE,cAAc,CAAC,UAAU,CAAC;IAI3C,KAAK,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI;IAmBhC,eAAe,UAAS;IACxB,aAAa,EAAE,CAAC,MAAM,IAAI,CAAC,EAAE,CAAM;IACnC,MAAM,CAAC,OAAO,GAAE,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,SAAqB,EAAE,IAAI,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI;CA4B1F"}
@@ -0,0 +1,45 @@
1
+ export class LogWriterStream {
2
+ constructor(out) {
3
+ this._toFlush = [];
4
+ this._flushIsRunning = false;
5
+ this._flushDoneFns = [];
6
+ this._out = out;
7
+ }
8
+ write(encoded) {
9
+ const my = async () => {
10
+ try {
11
+ const writer = this._out.getWriter();
12
+ await writer.ready;
13
+ await writer.write(encoded);
14
+ await writer.releaseLock();
15
+ }
16
+ catch (err) {
17
+ console.error("Chunk error:", err);
18
+ }
19
+ };
20
+ this._toFlush.push(my);
21
+ this._flush();
22
+ }
23
+ _flush(toFlush = undefined, done) {
24
+ if (done) {
25
+ this._flushDoneFns.push(done);
26
+ }
27
+ if (this._toFlush.length == 0) {
28
+ this._flushIsRunning = false;
29
+ this._flushDoneFns.forEach((fn) => fn());
30
+ this._flushDoneFns = [];
31
+ return;
32
+ }
33
+ if (!toFlush && this._toFlush.length == 1 && !this._flushIsRunning) {
34
+ this._flushIsRunning = true;
35
+ }
36
+ else if (!toFlush) {
37
+ return;
38
+ }
39
+ const my = this._toFlush.shift();
40
+ my === null || my === void 0 ? void 0 : my().finally(() => {
41
+ this._flush(this._toFlush);
42
+ });
43
+ }
44
+ }
45
+ //# sourceMappingURL=log-writer-impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"log-writer-impl.js","sourceRoot":"","sources":["../../src/log-writer-impl.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,eAAe;IAI1B,YAAY,GAA+B;QAFlC,aAAQ,GAA4B,EAAE,CAAC;QAyBhD,oBAAe,GAAG,KAAK,CAAC;QACxB,kBAAa,GAAmB,EAAE,CAAC;QAvBjC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,OAAmB;QACvB,MAAM,EAAE,GAAG,KAAK,IAAmB,EAAE;YAGnC,IAAI,CAAC;gBACH,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACrC,MAAM,MAAM,CAAC,KAAK,CAAC;gBACnB,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;gBAC5B,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;YAC7B,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBAEb,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;YACrC,CAAC;QAEH,CAAC,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACvB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;IAID,MAAM,CAAC,UAA+C,SAAS,EAAE,IAAiB;QAChF,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;QAED,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YAE9B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;YAC7B,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACzC,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;YACxB,OAAO;QACT,CAAC;QAED,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACnE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;QAE9B,CAAC;aAAM,IAAI,CAAC,OAAO,EAAE,CAAC;YAEpB,OAAO;QACT,CAAC;QAGD,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjC,EAAE,aAAF,EAAE,uBAAF,EAAE,GAAK,OAAO,CAAC,GAAG,EAAE;YAElB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,71 @@
1
+ import { AsError, FnSerialized, LogSerializable, Level, Logger, WithLogger, LevelHandler, LogFormatter } from "./logger.js";
2
+ import { SysAbstraction } from "./sys-abstraction.js";
3
+ import { Result } from "./result.js";
4
+ import { CoerceURI } from "./uri.js";
5
+ import { LogWriterStream } from "./log-writer-impl.js";
6
+ import { TxtEnDecoder } from "./txt-en-decoder.js";
7
+ export declare class JSONFormatter implements LogFormatter {
8
+ private readonly _txtEnDe;
9
+ private readonly _space?;
10
+ constructor(txtEnde: TxtEnDecoder, space?: number);
11
+ format(attr: LogSerializable): Uint8Array;
12
+ }
13
+ export declare class YAMLFormatter implements LogFormatter {
14
+ private readonly _txtEnDe;
15
+ private readonly _space?;
16
+ constructor(txtEnde: TxtEnDecoder, space?: number);
17
+ format(attr: LogSerializable): Uint8Array;
18
+ }
19
+ export interface LoggerImplParams {
20
+ readonly out?: WritableStream<Uint8Array>;
21
+ readonly logWriter?: LogWriterStream;
22
+ readonly sys?: SysAbstraction;
23
+ readonly withAttributes?: LogSerializable;
24
+ readonly levelHandler?: LevelHandler;
25
+ readonly txtEnDe?: TxtEnDecoder;
26
+ readonly formatter?: LogFormatter;
27
+ }
28
+ export declare class LoggerImpl implements Logger {
29
+ readonly _sys: SysAbstraction;
30
+ readonly _attributes: LogSerializable;
31
+ readonly _withAttributes: LogSerializable;
32
+ readonly _logWriter: LogWriterStream;
33
+ readonly _levelHandler: LevelHandler;
34
+ readonly _txtEnDe: TxtEnDecoder;
35
+ _formatter: LogFormatter;
36
+ constructor(params?: LoggerImplParams);
37
+ TxtEnDe(): TxtEnDecoder;
38
+ Attributes(): Record<string, unknown>;
39
+ SetExposeStack(enable?: boolean): Logger;
40
+ EnableLevel(level: Level, ...modules: string[]): Logger;
41
+ DisableLevel(level: Level, ...modules: string[]): Logger;
42
+ Module(key: string): Logger;
43
+ SetDebug(...modules: (string | string[])[]): Logger;
44
+ SetFormatter(formatter: LogFormatter): Logger;
45
+ Timestamp(): Logger;
46
+ Warn(): Logger;
47
+ Log(): Logger;
48
+ Debug(): Logger;
49
+ Error(): Logger;
50
+ Info(): Logger;
51
+ Err(err: unknown | Result<unknown> | Error): Logger;
52
+ WithLevel(l: Level): Logger;
53
+ Ref(key: string, action: {
54
+ toString: () => string;
55
+ } | FnSerialized): Logger;
56
+ Bool(key: string, value: unknown): Logger;
57
+ Result<T>(key: string, res: Result<T, Error>): Logger;
58
+ Len(value: unknown, key?: string): Logger;
59
+ Hash(value: unknown, key?: string): Logger;
60
+ Url(url: CoerceURI, key?: string): Logger;
61
+ Str(key: string, value?: string): Logger;
62
+ Any(key: string, value?: string | number | boolean | LogSerializable): Logger;
63
+ Dur(key: string, nsec: number): Logger;
64
+ Uint64(key: string, value: number): Logger;
65
+ Int(key: string, value: number): Logger;
66
+ Flush(): Promise<void>;
67
+ With(): WithLogger;
68
+ _resetAttributes(fn: () => () => Uint8Array): () => Uint8Array;
69
+ Msg(...args: string[]): AsError;
70
+ }
71
+ //# sourceMappingURL=logger-impl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-impl.d.ts","sourceRoot":"","sources":["../../src/logger-impl.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EACP,YAAY,EACZ,eAAe,EACf,KAAK,EACL,MAAM,EAGN,UAAU,EAMV,YAAY,EACZ,YAAY,EAEb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,SAAS,EAAO,MAAM,UAAU,CAAC;AAG1C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,YAAY,EAA0B,MAAM,qBAAqB,CAAC;AAkC3E,qBAAa,aAAc,YAAW,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;gBACrB,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,MAAM;IAIjD,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,UAAU;CAG1C;AAED,qBAAa,aAAc,YAAW,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAS;gBACrB,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,EAAE,MAAM;IAIjD,MAAM,CAAC,IAAI,EAAE,eAAe,GAAG,UAAU;CAG1C;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,GAAG,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;IAC1C,QAAQ,CAAC,SAAS,CAAC,EAAE,eAAe,CAAC;IACrC,QAAQ,CAAC,G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GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO;CAuBhC"}
@@ -0,0 +1,412 @@
1
+ import YAML from "yaml";
2
+ import { Level, logValue, removeSelfRef, asyncLogValue, } from "./logger.js";
3
+ import { WebSysAbstraction } from "./web/web-sys-abstraction.js";
4
+ import { Result } from "./result.js";
5
+ import { URI } from "./uri.js";
6
+ import { runtimeFn } from "./runtime.js";
7
+ import { ConsoleWriterStream } from "./utils/console-write-stream.js";
8
+ import { LogWriterStream } from "./log-writer-impl.js";
9
+ import { Utf8EnDecoderSingleton } from "./txt-en-decoder.js";
10
+ import { LevelHandlerSingleton } from "./log-level-impl.js";
11
+ function getLen(value) {
12
+ if (Array.isArray(value)) {
13
+ return logValue(() => value.length);
14
+ }
15
+ else if (typeof value === "string") {
16
+ return logValue(() => value.length);
17
+ }
18
+ else if (typeof value === "object" && value !== null) {
19
+ if (typeof value.size === "number") {
20
+ return logValue(() => value.size);
21
+ }
22
+ else if (typeof value.length === "number") {
23
+ return logValue(() => value.length);
24
+ }
25
+ return logValue(() => Object.keys(value).length);
26
+ }
27
+ return logValue(() => -1);
28
+ }
29
+ function hash(value) {
30
+ return "not implemented";
31
+ }
32
+ function toLogValue(lop) {
33
+ if (lop && typeof lop.then === "function") {
34
+ throw new Error("async logValue Not implemented");
35
+ }
36
+ return lop;
37
+ }
38
+ export class JSONFormatter {
39
+ constructor(txtEnde, space) {
40
+ this._txtEnDe = txtEnde;
41
+ this._space = space;
42
+ }
43
+ format(attr) {
44
+ return this._txtEnDe.encode(JSON.stringify(attr, removeSelfRef(), this._space) + "\n");
45
+ }
46
+ }
47
+ export class YAMLFormatter {
48
+ constructor(txtEnde, space) {
49
+ this._txtEnDe = txtEnde;
50
+ this._space = space;
51
+ }
52
+ format(attr) {
53
+ return this._txtEnDe.encode("---\n" + YAML.stringify(attr, removeSelfRef(), this._space) + "\n");
54
+ }
55
+ }
56
+ export class LoggerImpl {
57
+ constructor(params) {
58
+ this._attributes = {};
59
+ if (!params) {
60
+ params = {};
61
+ }
62
+ if (!params.sys) {
63
+ this._sys = WebSysAbstraction();
64
+ }
65
+ else {
66
+ this._sys = params.sys;
67
+ }
68
+ if (!params.txtEnDe) {
69
+ this._txtEnDe = Utf8EnDecoderSingleton();
70
+ }
71
+ else {
72
+ this._txtEnDe = params.txtEnDe;
73
+ }
74
+ if (!params.formatter) {
75
+ this._formatter = new JSONFormatter(this._txtEnDe);
76
+ }
77
+ else {
78
+ this._formatter = params.formatter;
79
+ }
80
+ if (params.logWriter) {
81
+ this._logWriter = params.logWriter;
82
+ }
83
+ else {
84
+ if (!params.out) {
85
+ const rt = runtimeFn();
86
+ let stream;
87
+ if (rt.isBrowser) {
88
+ stream = new ConsoleWriterStream();
89
+ }
90
+ else {
91
+ if (rt.isNodeIsh || rt.isReactNative || rt.isDeno) {
92
+ stream = this._sys.Stdout();
93
+ }
94
+ else {
95
+ throw new Error("No output defined for runtime");
96
+ }
97
+ }
98
+ this._logWriter = new LogWriterStream(stream);
99
+ }
100
+ else {
101
+ this._logWriter = new LogWriterStream(params.out);
102
+ }
103
+ }
104
+ if (!params.withAttributes) {
105
+ this._withAttributes = {};
106
+ }
107
+ else {
108
+ this._withAttributes = Object.assign({}, params.withAttributes);
109
+ }
110
+ this._attributes = Object.assign({}, this._withAttributes);
111
+ if (params.levelHandler) {
112
+ this._levelHandler = params.levelHandler;
113
+ }
114
+ else {
115
+ this._levelHandler = LevelHandlerSingleton();
116
+ }
117
+ }
118
+ TxtEnDe() {
119
+ return this._txtEnDe;
120
+ }
121
+ Attributes() {
122
+ return JSON.parse(JSON.stringify(this._attributes, removeSelfRef()));
123
+ }
124
+ SetExposeStack(enable) {
125
+ this._levelHandler.setExposeStack(enable);
126
+ return this;
127
+ }
128
+ EnableLevel(level, ...modules) {
129
+ this._levelHandler.enableLevel(level, ...modules);
130
+ return this;
131
+ }
132
+ DisableLevel(level, ...modules) {
133
+ this._levelHandler.disableLevel(level, ...modules);
134
+ return this;
135
+ }
136
+ Module(key) {
137
+ this._attributes["module"] = logValue(key);
138
+ this._withAttributes["module"] = logValue(key);
139
+ return this;
140
+ }
141
+ SetDebug(...modules) {
142
+ this._levelHandler.setDebug(...modules);
143
+ return this;
144
+ }
145
+ SetFormatter(formatter) {
146
+ this._formatter = formatter;
147
+ return this;
148
+ }
149
+ Timestamp() {
150
+ this._attributes["ts"] = logValue(() => this._sys.Time().Now().toISOString());
151
+ return this;
152
+ }
153
+ Warn() {
154
+ this._attributes["level"] = logValue(Level.WARN);
155
+ return this;
156
+ }
157
+ Log() {
158
+ return this;
159
+ }
160
+ Debug() {
161
+ this._attributes["level"] = logValue(Level.DEBUG);
162
+ return this;
163
+ }
164
+ Error() {
165
+ this._attributes["level"] = logValue(Level.ERROR);
166
+ return this;
167
+ }
168
+ Info() {
169
+ this._attributes["level"] = logValue(Level.INFO);
170
+ return this;
171
+ }
172
+ Err(err) {
173
+ var _a;
174
+ if (Result.Is(err)) {
175
+ if (err.isOk()) {
176
+ this.Result("noerror", err);
177
+ }
178
+ else {
179
+ this.Result("error", err);
180
+ }
181
+ }
182
+ else if (err instanceof Error) {
183
+ this._attributes["error"] = logValue(err.message);
184
+ if (this._levelHandler.isStackExposed) {
185
+ this._attributes["stack"] = logValue((_a = err.stack) === null || _a === void 0 ? void 0 : _a.split("\n").map((s) => s.trim()));
186
+ }
187
+ }
188
+ else {
189
+ this._attributes["error"] = logValue("" + err);
190
+ }
191
+ return this;
192
+ }
193
+ WithLevel(l) {
194
+ this._attributes["level"] = logValue(l);
195
+ return this;
196
+ }
197
+ Ref(key, action) {
198
+ if (typeof action === "function") {
199
+ this._attributes[key] = logValue(action);
200
+ }
201
+ else if (typeof action.toString === "function") {
202
+ this._attributes[key] = logValue(() => action.toString());
203
+ }
204
+ else {
205
+ this._attributes[key] = logValue("INVALID REF");
206
+ }
207
+ return this;
208
+ }
209
+ Bool(key, value) {
210
+ this._attributes[key] = logValue(!!value);
211
+ return this;
212
+ }
213
+ Result(key, res) {
214
+ if (res.isOk()) {
215
+ this._attributes[key] = logValue(res.Ok());
216
+ }
217
+ else {
218
+ this.Err(res.Err());
219
+ }
220
+ return this;
221
+ }
222
+ Len(value, key = "len") {
223
+ this._attributes[key] = getLen(value);
224
+ return this;
225
+ }
226
+ Hash(value, key = "hash") {
227
+ this._attributes[key] = asyncLogValue(async () => `${getLen(value).value()}:${await hash(value)}`);
228
+ return this;
229
+ }
230
+ Url(url, key = "url") {
231
+ this.Ref(key, () => URI.from(url).toString());
232
+ return this;
233
+ }
234
+ Str(key, value) {
235
+ this._attributes[key] = logValue(value);
236
+ return this;
237
+ }
238
+ Any(key, value) {
239
+ this._attributes[key] = logValue(value);
240
+ return this;
241
+ }
242
+ Dur(key, nsec) {
243
+ this._attributes[key] = logValue(`${nsec}ms`);
244
+ return this;
245
+ }
246
+ Uint64(key, value) {
247
+ this._attributes[key] = logValue(value);
248
+ return this;
249
+ }
250
+ Int(key, value) {
251
+ return this.Uint64(key, value);
252
+ }
253
+ async Flush() {
254
+ return new Promise((resolve) => {
255
+ this._logWriter._flush(undefined, resolve);
256
+ });
257
+ }
258
+ With() {
259
+ return new WithLoggerBuilder(new LoggerImpl({
260
+ logWriter: this._logWriter,
261
+ sys: this._sys,
262
+ levelHandler: this._levelHandler,
263
+ formatter: this._formatter,
264
+ withAttributes: Object.assign({ module: this._attributes["module"] }, this._withAttributes),
265
+ }));
266
+ }
267
+ _resetAttributes(fn) {
268
+ const ret = fn();
269
+ Object.keys(this._attributes).forEach((key) => {
270
+ delete this._attributes[key];
271
+ });
272
+ Object.assign(this._attributes, this._withAttributes);
273
+ return ret;
274
+ }
275
+ Msg(...args) {
276
+ const fnError = this._resetAttributes(() => {
277
+ var _a, _b;
278
+ const doWrite = this._levelHandler.isEnabled((_a = toLogValue(this._attributes["level"])) === null || _a === void 0 ? void 0 : _a.value(), (_b = toLogValue(this._attributes["module"])) === null || _b === void 0 ? void 0 : _b.value());
279
+ this._attributes["msg"] = logValue(args.join(" "));
280
+ const msg = this._attributes["msg"].value();
281
+ if (typeof msg === "string" && !msg.trim().length) {
282
+ delete this._attributes["msg"];
283
+ }
284
+ let fnRet = () => this._formatter.format(Object.assign({}, this._attributes));
285
+ if (doWrite) {
286
+ const encoded = fnRet();
287
+ this._logWriter.write(encoded);
288
+ fnRet = () => encoded;
289
+ }
290
+ return fnRet;
291
+ });
292
+ return {
293
+ AsError: () => new Error(this._txtEnDe.decode(fnError())),
294
+ };
295
+ }
296
+ }
297
+ class WithLoggerBuilder {
298
+ constructor(li) {
299
+ this._li = li;
300
+ }
301
+ TxtEnDe() {
302
+ return this._li.TxtEnDe();
303
+ }
304
+ Logger() {
305
+ Object.assign(this._li._withAttributes, this._li._attributes);
306
+ return this._li;
307
+ }
308
+ Attributes() {
309
+ return Object.assign({}, this._li._attributes);
310
+ }
311
+ SetExposeStack(enable) {
312
+ this._li._levelHandler.setExposeStack(enable);
313
+ return this;
314
+ }
315
+ SetFormatter(fmt) {
316
+ this._li.SetFormatter(fmt);
317
+ return this;
318
+ }
319
+ EnableLevel(level, ...modules) {
320
+ this._li._levelHandler.enableLevel(level, ...modules);
321
+ return this;
322
+ }
323
+ DisableLevel(level, ...modules) {
324
+ this._li._levelHandler.enableLevel(level, ...modules);
325
+ return this;
326
+ }
327
+ Module(key) {
328
+ this._li.Module(key);
329
+ return this;
330
+ }
331
+ SetDebug(...modules) {
332
+ this._li.SetDebug(...modules);
333
+ return this;
334
+ }
335
+ Str(key, value) {
336
+ this._li.Str(key, value);
337
+ return this;
338
+ }
339
+ Len(value, key) {
340
+ this._li.Len(value, key);
341
+ return this;
342
+ }
343
+ Hash(value, key) {
344
+ this._li.Hash(value, key);
345
+ return this;
346
+ }
347
+ Ref(key, action) {
348
+ this._li.Ref(key, action);
349
+ return this;
350
+ }
351
+ Bool(key, value) {
352
+ this._li.Bool(key, value);
353
+ return this;
354
+ }
355
+ Result(key, res) {
356
+ this._li.Result(key, res);
357
+ return this;
358
+ }
359
+ Url(url, key) {
360
+ this._li.Url(url, key);
361
+ return this;
362
+ }
363
+ Int(key, value) {
364
+ this._li.Int(key, value);
365
+ return this;
366
+ }
367
+ Log() {
368
+ this._li.Log();
369
+ return this;
370
+ }
371
+ WithLevel(level) {
372
+ this._li.WithLevel(level);
373
+ return this;
374
+ }
375
+ Error() {
376
+ this._li.Error();
377
+ return this;
378
+ }
379
+ Warn() {
380
+ this._li.Error();
381
+ return this;
382
+ }
383
+ Debug() {
384
+ this._li.Debug();
385
+ return this;
386
+ }
387
+ Err(err) {
388
+ this._li.Err(err);
389
+ return this;
390
+ }
391
+ Info() {
392
+ this._li.Info();
393
+ return this;
394
+ }
395
+ Timestamp() {
396
+ this._li.Timestamp();
397
+ return this;
398
+ }
399
+ Any(key, value) {
400
+ this._li.Any(key, value);
401
+ return this;
402
+ }
403
+ Dur(key, nsec) {
404
+ this._li.Dur(key, nsec);
405
+ return this;
406
+ }
407
+ Uint64(key, value) {
408
+ this._li.Uint64(key, value);
409
+ return this;
410
+ }
411
+ }
412
+ //# sourceMappingURL=logger-impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger-impl.js","sourceRoot":"","sources":["../../src/logger-impl.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,KAAK,EAEL,QAAQ,EAGR,aAAa,EAIb,aAAa,GAId,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAa,GAAG,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAgB,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,qBAAqB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