Throws an error, I assume because somewhere pino creates a worker thread that tries to clone the transport options for pino-roll and functions can't be cloned:
node:internal/worker:266
this[kPort].postMessage({
^
DOMException [DataCloneError]: function dummyGetLogPath() {
return path.join("E:/foo/", "filename");
} could not be cloned.
at new DOMException (node:internal/per_context/domexception:53:5)
at new Worker (node:internal/worker:266:17)
at createWorker (C:\Users\Lucas\pino-roll-issue\node_modules\thread-stream\index.js:55:18)
at new ThreadStream (C:\Users\Lucas\pino-roll-issue\node_modules\thread-stream\index.js:230:19)
at buildStream (C:\Users\Lucas\pino-roll-issue\node_modules\pino\lib\transport.js:21:18)
at Function.transport (C:\Users\Lucas\pino-roll-issue\node_modules\pino\lib\transport.js:114:10)
at Object.<anonymous> (C:\Users\Lucas\pino-roll-issue\index.js:63:8)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
Expected behavior
The function passed is called to get the name of the log files.
Description
Passing a function that returns a string to the
file
property ofoptions
throws an error.To reproduce
Current behavior
Throws an error, I assume because somewhere pino creates a worker thread that tries to clone the transport options for pino-roll and functions can't be cloned:
Expected behavior
The function passed is called to get the name of the log files.