Skip to content

Commit

Permalink
fix: Error when calling readAllLogs, fixes #414
Browse files Browse the repository at this point in the history
  • Loading branch information
megahertz committed Apr 6, 2024
1 parent 58dcfae commit 40b03bc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/node/transports/file/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,13 @@ function fileTransportFactory(
}

function readAllLogs({ fileFilter = (f) => f.endsWith('.log') } = {}) {
initializeOnFirstAccess();
const logsPath = path.dirname(transport.resolvePathFn(pathVariables));

if (!fs.existsSync(logsPath)) {
return [];
}

return fs.readdirSync(logsPath)
.map((fileName) => path.join(logsPath, fileName))
.filter(fileFilter)
Expand Down

0 comments on commit 40b03bc

Please sign in to comment.