Skip to content

Commit c98b4a2

Browse files
committed
fix(rivetkit): fix not pino bindings
1 parent d91f7e7 commit c98b4a2

File tree

1 file changed

+26
-5
lines changed
  • rivetkit-typescript/packages/rivetkit/src/common

1 file changed

+26
-5
lines changed

rivetkit-typescript/packages/rivetkit/src/common/log.ts

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export async function configureDefaultLogger(
146146
},
147147
},
148148
hooks: {
149-
logMethod(inputArgs, _method, level) {
149+
logMethod(inputArgs, method, level) {
150150
// TODO: This is a hack to not implement our own transport target. We can get better perf if we have our own transport target.
151151

152152
const levelMap: Record<number, string> = {
@@ -162,20 +162,41 @@ export async function configureDefaultLogger(
162162
getEnvUniversal("LOG_TIMESTAMP") === "1"
163163
? Date.now()
164164
: undefined;
165+
166+
// Get bindings from the logger instance (child logger fields)
167+
const bindings = (this as any).bindings?.() || {};
168+
165169
// TODO: This can be simplified in logfmt.ts
166170
if (inputArgs.length >= 2) {
167171
const [objOrMsg, msg] = inputArgs;
168172
if (typeof objOrMsg === "object" && objOrMsg !== null) {
169-
customWrite(levelName, { ...objOrMsg, msg, time });
173+
customWrite(levelName, {
174+
...bindings,
175+
...objOrMsg,
176+
msg,
177+
time,
178+
});
170179
} else {
171-
customWrite(levelName, { msg: String(objOrMsg), time });
180+
customWrite(levelName, {
181+
...bindings,
182+
msg: String(objOrMsg),
183+
time,
184+
});
172185
}
173186
} else if (inputArgs.length === 1) {
174187
const [objOrMsg] = inputArgs;
175188
if (typeof objOrMsg === "object" && objOrMsg !== null) {
176-
customWrite(levelName, { ...objOrMsg, time });
189+
customWrite(levelName, {
190+
...bindings,
191+
...objOrMsg,
192+
time,
193+
});
177194
} else {
178-
customWrite(levelName, { msg: String(objOrMsg), time });
195+
customWrite(levelName, {
196+
...bindings,
197+
msg: String(objOrMsg),
198+
time,
199+
});
179200
}
180201
}
181202
},

0 commit comments

Comments
 (0)