Skip to content

Commit

Permalink
Support file URLs when configuring multiple transports (#1961)
Browse files Browse the repository at this point in the history
  • Loading branch information
haines authored May 7, 2024
1 parent 14a8ead commit 3243b71
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
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

0 comments on commit 3243b71

Please sign in to comment.