Skip to content

Commit 7afdbeb

Browse files
committed
feat: US-185 - Add pino project-matrix fixture
1 parent 78b56da commit 7afdbeb

7 files changed

Lines changed: 200 additions & 1 deletion

File tree

docs/nodejs-compatibility.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ The [project-matrix test suite](https://github.com/rivet-dev/secure-exec/tree/ma
8282
| [bcryptjs](https://npmjs.com/package/bcryptjs) | Crypto | Pure JS password hashing and verification |
8383
| [chalk](https://npmjs.com/package/chalk) | Terminal | Terminal string styling, ANSI escape codes |
8484
| [lodash-es](https://npmjs.com/package/lodash-es) | Utility | Large ESM module resolution at scale |
85+
| [pino](https://npmjs.com/package/pino) | Logging | Structured JSON logging, child loggers, serializers |
8586
| [zod](https://npmjs.com/package/zod) | Validation | Schema definition, parsing, safe parse, transforms |
8687
| [rivetkit](https://npmjs.com/package/rivetkit) | SDK | Local vendor package resolution |
8788
| crypto (builtin) | Crypto | `crypto.randomBytes`, `randomUUID`, `getRandomValues` |

packages/secure-exec-core/isolate-runtime/src/inject/require-setup.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,6 +1455,18 @@
14551455
asyncStart: _createChannel(),
14561456
asyncEnd: _createChannel(),
14571457
error: _createChannel(),
1458+
traceSync: function (fn, context, thisArg) {
1459+
var args = Array.prototype.slice.call(arguments, 3);
1460+
return fn.apply(thisArg, args);
1461+
},
1462+
tracePromise: function (fn, context, thisArg) {
1463+
var args = Array.prototype.slice.call(arguments, 3);
1464+
return fn.apply(thisArg, args);
1465+
},
1466+
traceCallback: function (fn, context, thisArg) {
1467+
var args = Array.prototype.slice.call(arguments, 3);
1468+
return fn.apply(thisArg, args);
1469+
},
14581470
};
14591471
},
14601472
Channel: function Channel(name) {

packages/secure-exec-core/src/generated/isolate-runtime.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"entry": "src/index.js",
3+
"expectation": "pass"
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "project-matrix-pino-pass",
3+
"private": true,
4+
"type": "commonjs",
5+
"dependencies": {
6+
"pino": "^9.0.0"
7+
}
8+
}

packages/secure-exec/tests/projects/pino-pass/pnpm-lock.yaml

Lines changed: 106 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
"use strict";
2+
3+
const pino = require("pino");
4+
5+
// Use process.stdout as destination for sandbox compatibility
6+
// Disable variable fields (timestamp, pid, hostname) for deterministic output
7+
const logger = pino(
8+
{
9+
timestamp: false,
10+
base: undefined,
11+
},
12+
process.stdout
13+
);
14+
15+
// Basic logging at different levels
16+
logger.info("hello from pino");
17+
logger.warn("this is a warning");
18+
logger.error("something went wrong");
19+
20+
// Structured data
21+
logger.info({ user: "alice", action: "login" }, "user event");
22+
23+
// Child logger with bound properties
24+
const child = logger.child({ module: "auth" });
25+
child.info("child logger message");
26+
child.info({ detail: "extra" }, "child with data");
27+
28+
// Custom serializers
29+
const custom = pino(
30+
{
31+
timestamp: false,
32+
base: undefined,
33+
serializers: {
34+
req: (val) => ({ method: val.method, url: val.url }),
35+
},
36+
},
37+
process.stdout
38+
);
39+
custom.info(
40+
{ req: { method: "GET", url: "/api", headers: { host: "localhost" } } },
41+
"request received"
42+
);
43+
44+
// Silent level (should not output)
45+
const silent = pino(
46+
{
47+
timestamp: false,
48+
base: undefined,
49+
level: "error",
50+
},
51+
process.stdout
52+
);
53+
silent.info("this should not appear");
54+
silent.error("only errors visible");
55+
56+
// Log levels are numeric
57+
console.log(
58+
JSON.stringify({
59+
levels: {
60+
trace: logger.levels.values.trace,
61+
debug: logger.levels.values.debug,
62+
info: logger.levels.values.info,
63+
warn: logger.levels.values.warn,
64+
error: logger.levels.values.error,
65+
fatal: logger.levels.values.fatal,
66+
},
67+
})
68+
);

0 commit comments

Comments
 (0)