@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.
- package/README.md +149 -51
- package/dist/cjs/{config.js → config/index.js} +1 -1
- package/dist/cjs/{constants.d.ts → const/index.d.ts} +0 -5
- package/dist/cjs/{constants.js → const/index.js} +2 -8
- package/dist/cjs/{caller → domain/caller}/getCaller.js +1 -1
- package/dist/cjs/{colors → domain/colors}/color.js +1 -1
- package/dist/cjs/{decorations → domain/decorations}/link.js +1 -1
- package/dist/cjs/{terminal → domain/terminal}/isTTY.js +1 -1
- package/dist/cjs/{time → domain/time}/getTimeStamp.js +1 -1
- package/dist/cjs/domain/write/helpers/buildContext.d.ts +16 -0
- package/dist/cjs/domain/write/helpers/buildContext.js +40 -0
- package/dist/{core/writeLog → cjs/domain/write}/helpers/formatLocation.d.ts +1 -1
- package/dist/cjs/{core/writeLog → domain/write}/helpers/formatLocation.js +2 -2
- package/dist/cjs/{core/writeLog → domain/write}/helpers/index.d.ts +1 -0
- package/dist/cjs/{core/writeLog → domain/write}/helpers/index.js +5 -2
- package/dist/cjs/{core/writeLog → domain/write}/helpers/renderMessage.js +6 -5
- package/dist/cjs/{core/writeLog → domain/write}/helpers/visibleLines.js +3 -3
- package/dist/cjs/{core/writeLog → domain/write}/index.js +1 -1
- package/dist/{core/writeLog → cjs/domain/write}/writeLog.d.ts +2 -2
- package/dist/cjs/domain/write/writeLog.js +24 -0
- package/dist/cjs/features/logger/index.d.ts +1 -0
- package/dist/cjs/features/logger/index.js +21 -0
- package/dist/cjs/features/logger-error/index.d.ts +1 -0
- package/dist/cjs/features/logger-error/index.js +21 -0
- package/dist/cjs/features/logger-group/createGroup.d.ts +11 -0
- package/dist/cjs/features/logger-group/createGroup.js +21 -0
- package/dist/cjs/features/logger-group/index.d.ts +1 -0
- package/dist/cjs/features/logger-group/index.js +14 -0
- package/dist/cjs/features/logger-group/writeGroup.d.ts +8 -0
- package/dist/cjs/features/logger-group/writeGroup.js +20 -0
- package/dist/cjs/features/logger-max-lines/index.d.ts +1 -0
- package/dist/cjs/features/logger-max-lines/index.js +12 -0
- package/dist/cjs/features/logger-tap/createTap.d.ts +5 -0
- package/dist/cjs/features/logger-tap/createTap.js +33 -0
- package/dist/cjs/features/logger-tap/index.d.ts +1 -0
- package/dist/cjs/features/logger-tap/index.js +14 -0
- package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/buildBlock.js +2 -2
- package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/format.js +2 -2
- package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/index.js +1 -1
- package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/isThenable.js +1 -1
- package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/response.js +2 -2
- package/dist/cjs/{tap → features/logger-tap}/tapAsync/index.js +1 -1
- package/dist/cjs/{tap → features/logger-tap}/tapAsync/tapAsync.d.ts +1 -1
- package/dist/cjs/{tap → features/logger-tap}/tapAsync/tapAsync.js +6 -3
- package/dist/cjs/features/logger-warn/index.d.ts +1 -0
- package/dist/cjs/features/logger-warn/index.js +21 -0
- package/dist/cjs/index.d.ts +17 -1
- package/dist/cjs/index.js +12 -8
- package/dist/cjs/types/index.d.ts +2 -0
- package/dist/cjs/types/index.js +8 -0
- package/dist/{config.js → config/index.js} +1 -1
- package/dist/{constants.d.ts → const/index.d.ts} +0 -5
- package/dist/{constants.js → const/index.js} +1 -7
- package/dist/{caller → domain/caller}/getCaller.js +1 -1
- package/dist/{colors → domain/colors}/color.js +1 -1
- package/dist/{decorations → domain/decorations}/link.js +1 -1
- package/dist/{terminal → domain/terminal}/isTTY.js +1 -1
- package/dist/{time → domain/time}/getTimeStamp.js +1 -1
- package/dist/domain/write/helpers/buildContext.d.ts +16 -0
- package/dist/domain/write/helpers/buildContext.js +33 -0
- package/dist/{cjs/core/writeLog → domain/write}/helpers/formatLocation.d.ts +1 -1
- package/dist/{core/writeLog → domain/write}/helpers/formatLocation.js +2 -2
- package/dist/{core/writeLog → domain/write}/helpers/index.d.ts +1 -0
- package/dist/{core/writeLog → domain/write}/helpers/index.js +2 -1
- package/dist/{core/writeLog → domain/write}/helpers/renderMessage.js +5 -4
- package/dist/{core/writeLog → domain/write}/helpers/visibleLines.js +2 -2
- package/dist/{core/writeLog → domain/write}/index.js +1 -1
- package/dist/{cjs/core/writeLog → domain/write}/writeLog.d.ts +2 -2
- package/dist/domain/write/writeLog.js +21 -0
- package/dist/features/logger/index.d.ts +1 -0
- package/dist/features/logger/index.js +15 -0
- package/dist/features/logger-error/index.d.ts +1 -0
- package/dist/features/logger-error/index.js +15 -0
- package/dist/features/logger-group/createGroup.d.ts +11 -0
- package/dist/features/logger-group/createGroup.js +15 -0
- package/dist/features/logger-group/index.d.ts +1 -0
- package/dist/features/logger-group/index.js +7 -0
- package/dist/features/logger-group/writeGroup.d.ts +8 -0
- package/dist/features/logger-group/writeGroup.js +17 -0
- package/dist/features/logger-max-lines/index.d.ts +1 -0
- package/dist/features/logger-max-lines/index.js +7 -0
- package/dist/features/logger-tap/createTap.d.ts +5 -0
- package/dist/features/logger-tap/createTap.js +27 -0
- package/dist/features/logger-tap/index.d.ts +1 -0
- package/dist/features/logger-tap/index.js +7 -0
- package/dist/{tap → features/logger-tap}/tapAsync/helpers/buildBlock.js +2 -2
- package/dist/{tap → features/logger-tap}/tapAsync/helpers/format.js +2 -2
- package/dist/{tap → features/logger-tap}/tapAsync/helpers/index.js +1 -1
- package/dist/{tap → features/logger-tap}/tapAsync/helpers/isThenable.js +1 -1
- package/dist/{tap → features/logger-tap}/tapAsync/helpers/response.js +2 -2
- package/dist/{tap → features/logger-tap}/tapAsync/index.js +1 -1
- package/dist/{tap → features/logger-tap}/tapAsync/tapAsync.d.ts +1 -1
- package/dist/{tap → features/logger-tap}/tapAsync/tapAsync.js +6 -3
- package/dist/features/logger-warn/index.d.ts +1 -0
- package/dist/features/logger-warn/index.js +15 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +12 -8
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +7 -0
- package/package.json +1 -1
- package/dist/cjs/core/createLog.d.ts +0 -8
- package/dist/cjs/core/createLog.js +0 -29
- package/dist/cjs/core/writeLog/writeLog.js +0 -43
- package/dist/cjs/tap/createTap.d.ts +0 -18
- package/dist/cjs/tap/createTap.js +0 -51
- package/dist/core/createLog.d.ts +0 -8
- package/dist/core/createLog.js +0 -23
- package/dist/core/writeLog/writeLog.js +0 -37
- package/dist/tap/createTap.d.ts +0 -18
- package/dist/tap/createTap.js +0 -45
- /package/dist/cjs/{config.d.ts → config/index.d.ts} +0 -0
- /package/dist/{caller → cjs/domain/caller}/getCaller.d.ts +0 -0
- /package/dist/cjs/{colors → domain/colors}/color.d.ts +0 -0
- /package/dist/cjs/{decorations → domain/decorations}/link.d.ts +0 -0
- /package/dist/cjs/{terminal → domain/terminal}/isTTY.d.ts +0 -0
- /package/dist/cjs/{time → domain/time}/getTimeStamp.d.ts +0 -0
- /package/dist/cjs/{core/writeLog → domain/write}/helpers/renderMessage.d.ts +0 -0
- /package/dist/cjs/{core/writeLog → domain/write}/helpers/visibleLines.d.ts +0 -0
- /package/dist/cjs/{core/writeLog → domain/write}/index.d.ts +0 -0
- /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/buildBlock.d.ts +0 -0
- /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/format.d.ts +0 -0
- /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/index.d.ts +0 -0
- /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/isThenable.d.ts +0 -0
- /package/dist/cjs/{tap → features/logger-tap}/tapAsync/helpers/response.d.ts +0 -0
- /package/dist/cjs/{tap → features/logger-tap}/tapAsync/index.d.ts +0 -0
- /package/dist/{config.d.ts → config/index.d.ts} +0 -0
- /package/dist/{cjs → domain}/caller/getCaller.d.ts +0 -0
- /package/dist/{colors → domain/colors}/color.d.ts +0 -0
- /package/dist/{decorations → domain/decorations}/link.d.ts +0 -0
- /package/dist/{terminal → domain/terminal}/isTTY.d.ts +0 -0
- /package/dist/{time → domain/time}/getTimeStamp.d.ts +0 -0
- /package/dist/{core/writeLog → domain/write}/helpers/renderMessage.d.ts +0 -0
- /package/dist/{core/writeLog → domain/write}/helpers/visibleLines.d.ts +0 -0
- /package/dist/{core/writeLog → domain/write}/index.d.ts +0 -0
- /package/dist/{tap → features/logger-tap}/tapAsync/helpers/buildBlock.d.ts +0 -0
- /package/dist/{tap → features/logger-tap}/tapAsync/helpers/format.d.ts +0 -0
- /package/dist/{tap → features/logger-tap}/tapAsync/helpers/index.d.ts +0 -0
- /package/dist/{tap → features/logger-tap}/tapAsync/helpers/isThenable.d.ts +0 -0
- /package/dist/{tap → features/logger-tap}/tapAsync/helpers/response.d.ts +0 -0
- /package/dist/{tap → features/logger-tap}/tapAsync/index.d.ts +0 -0
package/dist/tap/createTap.d.ts
DELETED
|
@@ -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;
|
package/dist/tap/createTap.js
DELETED
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|