@meadown/logger 1.8.11 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/README.md +149 -51
  2. package/dist/cjs/{config.js → config/index.js} +1 -1
  3. package/dist/cjs/{constants.d.ts → const/index.d.ts} +0 -5
  4. package/dist/cjs/{constants.js → const/index.js} +2 -8
  5. package/dist/cjs/{caller → domain/caller}/getCaller.js +1 -1
  6. package/dist/cjs/{colors → domain/colors}/color.js +1 -1
  7. package/dist/cjs/{decorations → domain/decorations}/link.js +1 -1
  8. package/dist/cjs/{terminal → domain/terminal}/isTTY.js +1 -1
  9. package/dist/cjs/{time → domain/time}/getTimeStamp.js +1 -1
  10. package/dist/cjs/domain/write/helpers/buildContext.d.ts +16 -0
  11. package/dist/cjs/domain/write/helpers/buildContext.js +40 -0
  12. package/dist/{core/writeLog → cjs/domain/write}/helpers/formatLocation.d.ts +1 -1
  13. package/dist/cjs/{core/writeLog → domain/write}/helpers/formatLocation.js +2 -2
  14. package/dist/cjs/{core/writeLog → domain/write}/helpers/index.d.ts +1 -0
  15. package/dist/cjs/{core/writeLog → domain/write}/helpers/index.js +5 -2
  16. package/dist/cjs/{core/writeLog → domain/write}/helpers/renderMessage.js +6 -5
  17. package/dist/cjs/{core/writeLog → domain/write}/helpers/visibleLines.js +3 -3
  18. package/dist/cjs/{core/writeLog → domain/write}/index.js +1 -1
  19. package/dist/{core/writeLog → cjs/domain/write}/writeLog.d.ts +2 -2
  20. package/dist/cjs/domain/write/writeLog.js +24 -0
  21. package/dist/cjs/features/logger/index.d.ts +1 -0
  22. package/dist/cjs/features/logger/index.js +21 -0
  23. package/dist/cjs/features/logger-error/index.d.ts +1 -0
  24. package/dist/cjs/features/logger-error/index.js +21 -0
  25. package/dist/cjs/features/logger-group/createGroup.d.ts +11 -0
  26. package/dist/cjs/features/logger-group/createGroup.js +21 -0
  27. package/dist/cjs/features/logger-group/index.d.ts +1 -0
  28. package/dist/cjs/features/logger-group/index.js +14 -0
  29. package/dist/cjs/features/logger-group/writeGroup.d.ts +8 -0
  30. package/dist/cjs/features/logger-group/writeGroup.js +20 -0
  31. package/dist/cjs/features/logger-max-lines/index.d.ts +1 -0
  32. package/dist/cjs/features/logger-max-lines/index.js +12 -0
  33. package/dist/cjs/features/logger-tap/createTap.d.ts +5 -0
  34. package/dist/cjs/features/logger-tap/createTap.js +33 -0
  35. package/dist/cjs/features/logger-tap/index.d.ts +1 -0
  36. package/dist/cjs/features/logger-tap/index.js +14 -0
  37. package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/buildBlock.js +2 -2
  38. package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/format.js +2 -2
  39. package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/index.js +1 -1
  40. package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/isThenable.js +1 -1
  41. package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/response.js +2 -2
  42. package/dist/cjs/{tap → features/logger-tap}/tapAsync/index.js +1 -1
  43. package/dist/cjs/{tap → features/logger-tap}/tapAsync/tapAsync.d.ts +1 -1
  44. package/dist/cjs/{tap → features/logger-tap}/tapAsync/tapAsync.js +6 -3
  45. package/dist/cjs/features/logger-warn/index.d.ts +1 -0
  46. package/dist/cjs/features/logger-warn/index.js +21 -0
  47. package/dist/cjs/index.d.ts +17 -1
  48. package/dist/cjs/index.js +12 -8
  49. package/dist/cjs/types/index.d.ts +2 -0
  50. package/dist/cjs/types/index.js +8 -0
  51. package/dist/{config.js → config/index.js} +1 -1
  52. package/dist/{constants.d.ts → const/index.d.ts} +0 -5
  53. package/dist/{constants.js → const/index.js} +1 -7
  54. package/dist/{caller → domain/caller}/getCaller.js +1 -1
  55. package/dist/{colors → domain/colors}/color.js +1 -1
  56. package/dist/{decorations → domain/decorations}/link.js +1 -1
  57. package/dist/{terminal → domain/terminal}/isTTY.js +1 -1
  58. package/dist/{time → domain/time}/getTimeStamp.js +1 -1
  59. package/dist/domain/write/helpers/buildContext.d.ts +16 -0
  60. package/dist/domain/write/helpers/buildContext.js +33 -0
  61. package/dist/{cjs/core/writeLog → domain/write}/helpers/formatLocation.d.ts +1 -1
  62. package/dist/{core/writeLog → domain/write}/helpers/formatLocation.js +2 -2
  63. package/dist/{core/writeLog → domain/write}/helpers/index.d.ts +1 -0
  64. package/dist/{core/writeLog → domain/write}/helpers/index.js +2 -1
  65. package/dist/{core/writeLog → domain/write}/helpers/renderMessage.js +5 -4
  66. package/dist/{core/writeLog → domain/write}/helpers/visibleLines.js +2 -2
  67. package/dist/{core/writeLog → domain/write}/index.js +1 -1
  68. package/dist/{cjs/core/writeLog → domain/write}/writeLog.d.ts +2 -2
  69. package/dist/domain/write/writeLog.js +21 -0
  70. package/dist/features/logger/index.d.ts +1 -0
  71. package/dist/features/logger/index.js +15 -0
  72. package/dist/features/logger-error/index.d.ts +1 -0
  73. package/dist/features/logger-error/index.js +15 -0
  74. package/dist/features/logger-group/createGroup.d.ts +11 -0
  75. package/dist/features/logger-group/createGroup.js +15 -0
  76. package/dist/features/logger-group/index.d.ts +1 -0
  77. package/dist/features/logger-group/index.js +7 -0
  78. package/dist/features/logger-group/writeGroup.d.ts +8 -0
  79. package/dist/features/logger-group/writeGroup.js +17 -0
  80. package/dist/features/logger-max-lines/index.d.ts +1 -0
  81. package/dist/features/logger-max-lines/index.js +7 -0
  82. package/dist/features/logger-tap/createTap.d.ts +5 -0
  83. package/dist/features/logger-tap/createTap.js +27 -0
  84. package/dist/features/logger-tap/index.d.ts +1 -0
  85. package/dist/features/logger-tap/index.js +7 -0
  86. package/dist/{tap → features/logger-tap}/tapAsync/helpers/buildBlock.js +2 -2
  87. package/dist/{tap → features/logger-tap}/tapAsync/helpers/format.js +2 -2
  88. package/dist/{tap → features/logger-tap}/tapAsync/helpers/index.js +1 -1
  89. package/dist/{tap → features/logger-tap}/tapAsync/helpers/isThenable.js +1 -1
  90. package/dist/{tap → features/logger-tap}/tapAsync/helpers/response.js +2 -2
  91. package/dist/{tap → features/logger-tap}/tapAsync/index.js +1 -1
  92. package/dist/{tap → features/logger-tap}/tapAsync/tapAsync.d.ts +1 -1
  93. package/dist/{tap → features/logger-tap}/tapAsync/tapAsync.js +6 -3
  94. package/dist/features/logger-warn/index.d.ts +1 -0
  95. package/dist/features/logger-warn/index.js +15 -0
  96. package/dist/index.d.ts +17 -1
  97. package/dist/index.js +12 -8
  98. package/dist/types/index.d.ts +2 -0
  99. package/dist/types/index.js +7 -0
  100. package/package.json +1 -1
  101. package/dist/cjs/core/createLog.d.ts +0 -8
  102. package/dist/cjs/core/createLog.js +0 -29
  103. package/dist/cjs/core/writeLog/writeLog.js +0 -43
  104. package/dist/cjs/tap/createTap.d.ts +0 -18
  105. package/dist/cjs/tap/createTap.js +0 -51
  106. package/dist/core/createLog.d.ts +0 -8
  107. package/dist/core/createLog.js +0 -23
  108. package/dist/core/writeLog/writeLog.js +0 -37
  109. package/dist/tap/createTap.d.ts +0 -18
  110. package/dist/tap/createTap.js +0 -45
  111. /package/dist/cjs/{config.d.ts → config/index.d.ts} +0 -0
  112. /package/dist/{caller → cjs/domain/caller}/getCaller.d.ts +0 -0
  113. /package/dist/cjs/{colors → domain/colors}/color.d.ts +0 -0
  114. /package/dist/cjs/{decorations → domain/decorations}/link.d.ts +0 -0
  115. /package/dist/cjs/{terminal → domain/terminal}/isTTY.d.ts +0 -0
  116. /package/dist/cjs/{time → domain/time}/getTimeStamp.d.ts +0 -0
  117. /package/dist/cjs/{core/writeLog → domain/write}/helpers/renderMessage.d.ts +0 -0
  118. /package/dist/cjs/{core/writeLog → domain/write}/helpers/visibleLines.d.ts +0 -0
  119. /package/dist/cjs/{core/writeLog → domain/write}/index.d.ts +0 -0
  120. /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/buildBlock.d.ts +0 -0
  121. /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/format.d.ts +0 -0
  122. /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/index.d.ts +0 -0
  123. /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/isThenable.d.ts +0 -0
  124. /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/response.d.ts +0 -0
  125. /package/dist/cjs/{tap → features/logger-tap}/tapAsync/index.d.ts +0 -0
  126. /package/dist/{config.d.ts → config/index.d.ts} +0 -0
  127. /package/dist/{cjs → domain}/caller/getCaller.d.ts +0 -0
  128. /package/dist/{colors → domain/colors}/color.d.ts +0 -0
  129. /package/dist/{decorations → domain/decorations}/link.d.ts +0 -0
  130. /package/dist/{terminal → domain/terminal}/isTTY.d.ts +0 -0
  131. /package/dist/{time → domain/time}/getTimeStamp.d.ts +0 -0
  132. /package/dist/{core/writeLog → domain/write}/helpers/renderMessage.d.ts +0 -0
  133. /package/dist/{core/writeLog → domain/write}/helpers/visibleLines.d.ts +0 -0
  134. /package/dist/{core/writeLog → domain/write}/index.d.ts +0 -0
  135. /package/dist/{tap → features/logger-tap}/tapAsync/helpers/buildBlock.d.ts +0 -0
  136. /package/dist/{tap → features/logger-tap}/tapAsync/helpers/format.d.ts +0 -0
  137. /package/dist/{tap → features/logger-tap}/tapAsync/helpers/index.d.ts +0 -0
  138. /package/dist/{tap → features/logger-tap}/tapAsync/helpers/isThenable.d.ts +0 -0
  139. /package/dist/{tap → features/logger-tap}/tapAsync/helpers/response.d.ts +0 -0
  140. /package/dist/{tap → features/logger-tap}/tapAsync/index.d.ts +0 -0
@@ -1,18 +0,0 @@
1
- /** Logs a value and returns it unchanged. Promises route to the timed path. */
2
- export interface Tap {
3
- <T>(value: T, label?: string): T;
4
- }
5
- /**
6
- * Builds `tap` — logs a value and returns it **unchanged**, so it drops into any
7
- * expression (`const u = logger.tap(getUser(), "user")`). The consumer always
8
- * gets back exactly what they passed; the only effect is a clean log.
9
- *
10
- * - A plain value is logged synchronously and returned.
11
- * - A **promise** is returned as-is (same object, never awaited or wrapped), and
12
- * its elapsed time — plus the HTTP status if it resolves to a `Response` — is
13
- * logged in the background (fire-and-forget, non-blocking).
14
- *
15
- * The returned closure is what the caller invokes directly, so {@link getCaller}
16
- * resolves the caller's own frame. Silent in production; the value still flows.
17
- */
18
- export default function createTap(): Tap;
@@ -1,45 +0,0 @@
1
- /*
2
- * createTap.ts
3
- * Created by Dewan Mobashirul
4
- * Copyright (c) 2026 dewan-meadown
5
- * All rights reserved
6
- */
7
- import { isLogAllowed } from "../config.js";
8
- import getCaller from "../caller/getCaller.js";
9
- import { writeLog } from "../core/writeLog/index.js";
10
- import { isThenable, tapAsync } from "./tapAsync/index.js";
11
- /**
12
- * Builds `tap` — logs a value and returns it **unchanged**, so it drops into any
13
- * expression (`const u = logger.tap(getUser(), "user")`). The consumer always
14
- * gets back exactly what they passed; the only effect is a clean log.
15
- *
16
- * - A plain value is logged synchronously and returned.
17
- * - A **promise** is returned as-is (same object, never awaited or wrapped), and
18
- * its elapsed time — plus the HTTP status if it resolves to a `Response` — is
19
- * logged in the background (fire-and-forget, non-blocking).
20
- *
21
- * The returned closure is what the caller invokes directly, so {@link getCaller}
22
- * resolves the caller's own frame. Silent in production; the value still flows.
23
- */
24
- export default function createTap() {
25
- const tap = (value, label) => {
26
- if (!isLogAllowed())
27
- return value;
28
- const caller = getCaller();
29
- if (isThenable(value)) {
30
- // value is a promise → hand off to the async tap (caller passed in so the
31
- // location stays on the user's file, not on this helper).
32
- tapAsync(value, label, caller);
33
- }
34
- else {
35
- writeLog({
36
- channel: "log",
37
- tag: "[TAP]",
38
- args: label === undefined ? [value] : [label, value],
39
- caller,
40
- });
41
- }
42
- return value;
43
- };
44
- return tap;
45
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes