Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Support file URLs when configuring multiple transports #1961

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/transport-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = loadTransportStreamBuilder
async function loadTransportStreamBuilder (target) {
let fn
try {
const toLoad = 'file://' + target
const toLoad = target.startsWith('file://') ? target : 'file://' + target

if (toLoad.endsWith('.ts') || toLoad.endsWith('.cts')) {
// TODO: add support for the TSM modules loader ( https://github.com/lukeed/tsm ).
Expand Down
2 changes: 1 addition & 1 deletion test/transport/core.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ test('pino.transport with two files', async ({ same, teardown }) => {
const transport = pino.transport({
targets: [{
level: 'info',
target: join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
target: 'file://' + join(__dirname, '..', 'fixtures', 'to-file-transport.js'),
options: { destination: dest1 }
}, {
level: 'info',
Expand Down