Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Added the extraCRDPChannelPort parameter and updated logs to be generated on %tmpdir%\vscode-chrome-debug.txt #465

Merged

Conversation

digeff
Copy link
Contributor

@digeff digeff commented Jul 25, 2017

Added the extraCRDPChannelPort parameter and updated logs to be generated on %tmpdir%\vscode-chrome-debug_%timestamp%.txt

…ated on %tmpdir%\vscode-chrome-debug_%timestamp%.txt
@msftclas
Copy link

@digeff,
Thanks for your contribution as a Microsoft full-time employee or intern. You do not need to sign a CLA.
Thanks,
Microsoft Pull Request Bot

@digeff
Copy link
Contributor Author

digeff commented Jul 26, 2017

@roblourens This changes need the vscode-chrome-debug-core dependency to be updated to the latest version before this can work... Do you want me to change that too?

// also note that __dirname here is out/
const logFilePath = path.resolve(__dirname, '../vscode-chrome-debug.txt');
// non-.txt file types can't be uploaded to github. Generated filename is something like: vscode-chrome-debug_2017-07-19_161210.txt
const timestampForFilename = new Date().toISOString().replace(/T/, '_').replace(/:/g, '').replace(/\..*/, '');
Copy link
Member

@roblourens roblourens Jul 26, 2017

Choose a reason for hiding this comment

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

Is this only needed for your tests? Could the adapter process be started with an environment var giving the name of the log file, or a flag to use the timestamp? Is that reasonable?

This is fine and tmpdir is fine, but I'm still thinking of a way to keep it writing to the same file on each run for vscode.

How will you find the log file? Are you just looking for the newest one in the tmpdir?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I only added the timestamp to avoid losing the logs the second time we run the debugger. Would appending to the log file rather than starting from scratch work for you?

Copy link
Member

Choose a reason for hiding this comment

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

No, then it would just get huge. I just prefer overwriting one file but we can keep this if it's what you need.

Technically we could specify this in the launch config, because the file name isn't actually used until the logger is initialized. It's just bad design on my part to set up the hypothetical file name ahead of time. But I don't care enough to change it right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. I'll leave the tmpdir change in this PR (it's the most important change for us), and we might send you a new PR with other logchanges using a launch.json parameter in the future.

Copy link
Member

Choose a reason for hiding this comment

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

I vaguely remember this coming up partly because of your tests running multiple instances of the adapter at once, and trampling each others' log files. If that's the case, you may not want to strip the milliseconds portion of the timestamp, because if two adapters start within the same second, they'll get the same log file name.

If I'm remembering wrong, ignore it...

@roblourens
Copy link
Member

roblourens commented Jul 26, 2017

Yeah could you also update vscode-chrome-debug-core?

@digeff digeff changed the title Added the extraCRDPChannelPort parameter and updated logs to be generated on %tmpdir%\vscode-chrome-debug_%timestamp%.txt Added the extraCRDPChannelPort parameter and updated logs to be generated on %tmpdir%\vscode-chrome-debug.txt Jul 26, 2017
@roblourens
Copy link
Member

I didn't mean you have to revert the timestamp logic for the log file name now - I'll merge this but it's totally ok to keep the timestamp in the name if you want.

@roblourens roblourens merged commit 2fc308c into microsoft:master Jul 26, 2017
@digeff
Copy link
Contributor Author

digeff commented Jul 26, 2017

I don't want to make your life more difficult, so if we need this we'll add it later as an optional launch.json parameter as you suggested.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants