@intx/log 0.2.2 → 0.4.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 +2 -1
- package/dist/default-sink-probe.d.ts +1 -0
- package/dist/default-sink-probe.js +15 -0
- package/dist/default-sink.d.ts +4 -4
- package/dist/default-sink.js +5 -5
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -31,7 +31,8 @@ logger.info`Sidecar ${sidecarId} registered`;
|
|
|
31
31
|
`configureSync`, `getConfig`, and `resetSync` for tests that need
|
|
32
32
|
to drive LogTape configuration directly. Importing the package
|
|
33
33
|
also installs the default console sink as a side effect so early
|
|
34
|
-
diagnostics work before `setup()` is called.
|
|
34
|
+
diagnostics work before `setup()` is called. Runtimes without a
|
|
35
|
+
Node `process` global use the development formatter by default.
|
|
35
36
|
- `@intx/log/hono` — Hono middleware re-exported from
|
|
36
37
|
`@logtape/hono` for HTTP request logging. Hono is an optional
|
|
37
38
|
peer dependency; only import this entry point from packages that
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Probe for the module-load contract: importing this package installs a
|
|
2
|
+
// default console sink. It runs as a child process because that contract
|
|
3
|
+
// cannot be observed in-process -- `installDefaultConsoleSink` returns early
|
|
4
|
+
// when a config already exists, and under a shared module registry some
|
|
5
|
+
// earlier file has almost always triggered the install already, so an
|
|
6
|
+
// in-process check reads back whatever that file left behind.
|
|
7
|
+
//
|
|
8
|
+
// Reports to stdout rather than through a logger, so the report cannot be
|
|
9
|
+
// routed by the very configuration under test.
|
|
10
|
+
import { getConfig } from "./index.js";
|
|
11
|
+
const config = getConfig();
|
|
12
|
+
process.stdout.write(JSON.stringify({
|
|
13
|
+
installed: config !== null,
|
|
14
|
+
sinks: config === null ? [] : Object.keys(config.sinks).sort(),
|
|
15
|
+
}));
|
package/dist/default-sink.d.ts
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
* in Node and Bun and on the devtools console in browsers, until `setup()`
|
|
8
8
|
* replaces the configuration.
|
|
9
9
|
*
|
|
10
|
-
* Formatter selection follows the same dev/prod heuristic as `setup()
|
|
11
|
-
*
|
|
12
|
-
* options on `setup()` cannot influence this
|
|
13
|
-
* passed at module load.
|
|
10
|
+
* Formatter selection follows the same dev/prod heuristic as `setup()`. A
|
|
11
|
+
* runtime without Node's `process` global uses development formatting; the
|
|
12
|
+
* caller-facing `dev`/`prod` options on `setup()` cannot influence this
|
|
13
|
+
* default because no options are passed at module load.
|
|
14
14
|
*
|
|
15
15
|
* This is normally invoked once at module load (see the bottom of this
|
|
16
16
|
* file). It is also exported so tests can reinstall the default sink after
|
package/dist/default-sink.js
CHANGED
|
@@ -8,10 +8,10 @@ import { configureSync, getConfig, getConsoleSink, ansiColorFormatter, getJsonLi
|
|
|
8
8
|
* in Node and Bun and on the devtools console in browsers, until `setup()`
|
|
9
9
|
* replaces the configuration.
|
|
10
10
|
*
|
|
11
|
-
* Formatter selection follows the same dev/prod heuristic as `setup()
|
|
12
|
-
*
|
|
13
|
-
* options on `setup()` cannot influence this
|
|
14
|
-
* passed at module load.
|
|
11
|
+
* Formatter selection follows the same dev/prod heuristic as `setup()`. A
|
|
12
|
+
* runtime without Node's `process` global uses development formatting; the
|
|
13
|
+
* caller-facing `dev`/`prod` options on `setup()` cannot influence this
|
|
14
|
+
* default because no options are passed at module load.
|
|
15
15
|
*
|
|
16
16
|
* This is normally invoked once at module load (see the bottom of this
|
|
17
17
|
* file). It is also exported so tests can reinstall the default sink after
|
|
@@ -25,7 +25,7 @@ import { configureSync, getConfig, getConsoleSink, ansiColorFormatter, getJsonLi
|
|
|
25
25
|
export function installDefaultConsoleSink() {
|
|
26
26
|
if (getConfig() !== null)
|
|
27
27
|
return;
|
|
28
|
-
const isDev = process.env["NODE_ENV"] !== "production";
|
|
28
|
+
const isDev = typeof process === "undefined" || process.env["NODE_ENV"] !== "production";
|
|
29
29
|
const formatter = isDev
|
|
30
30
|
? ansiColorFormatter
|
|
31
31
|
: getJsonLinesFormatter();
|
package/package.json
CHANGED