Skip to content

Conversation

@joehan
Copy link
Contributor

@joehan joehan commented Oct 8, 2024

Description

When not inside a firebase directory, write logs to ~/.cache/firebase/vscode. ~/.cache/firebase is already used by other places in the CLI.

const rootFolders = getRootFolders();
const filePath = path.join(rootFolders[0], ".firebase", "logs", "vsce-debug.log");
// Default to a central path, but write files to a local path if we're in a Firebase directory.
let filePath = "~/.cache/firebase/vscode/vsce-debug.log";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let filePath = "~/.cache/firebase/vscode/vsce-debug.log";
let filePath = "~/.cache/firebase/logs/vsce-debug.log";

And we also need a random segment to prevent conflicts across multiple windows.

And speaking of windows... Does it work on Windows (capital W)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And... one last thing, please use require('os').homedir() instead of ~ for portability

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good calls, done. Ignoring the random segment bit for now - different instances will write to the same log, which is fine for now imo.

@joehan joehan requested a review from yuchenshi October 8, 2024 21:07
@joehan joehan requested a review from hlshen October 8, 2024 21:21
@joehan joehan merged commit 80060cf into master Oct 8, 2024
40 of 41 checks passed
@joehan joehan deleted the jh-less-logs branch October 8, 2024 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants