Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Question: Logging in Extensions #44212

Closed
jpoon opened this issue Feb 22, 2018 · 6 comments
Closed

Question: Logging in Extensions #44212

jpoon opened this issue Feb 22, 2018 · 6 comments
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s) extension-host Extension host issues extensions Issues concerning extensions

Comments

@jpoon
Copy link

jpoon commented Feb 22, 2018

Issue Type

Question

Description

Is it possible to leverage a node logging library as an Extension developer?

Particularly, I tried using Winston, Bunyan, and Debug, but wasn't able to see any output in console (from the developer tools).

I suspect it is due to this: #19750, but "outputCapture": "std" isn't a supported attribute in launch.json for "type": "extensionHost".

Is there an established best-practice for logging in extensions?

VS Code Info

VS Code version: Code 1.20.1 (f88bbf9, 2018-02-13T15:23:28.607Z)
OS version: Darwin x64 17.4.0

@weinand weinand removed their assignment Feb 22, 2018
@ramya-rao-a ramya-rao-a added extensions Issues concerning extensions extension-host Extension host issues labels Feb 22, 2018
@ramya-rao-a
Copy link
Contributor

Doesnt console.log() output to the developer console?

@jpoon
Copy link
Author

jpoon commented Feb 23, 2018

Yes. console.log would work but I'd prefer to use one of the above mentioned logging libraries as they have some niceties like logging time and module. Obviously, I could wrap console.log to do the same but why re-write the wheel when I could leverage one of these npm libraries. The problem is that I couldn't get any of them to work.

Is there a recommended path for extension authors?

@ramya-rao-a
Copy link
Contributor

cc @joaomoreno @sandy081 on logging

@joaomoreno
Copy link
Member

joaomoreno commented Feb 23, 2018

/duplicate #43276

@jpoon We're in the process of providing logging API, check out the discussion in #43276

@vscodebot vscodebot bot added the *duplicate Issue identified as a duplicate of another issue(s) label Feb 23, 2018
@vscodebot
Copy link

vscodebot bot commented Feb 23, 2018

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Feb 23, 2018
@roblourens
Copy link
Member

@jpoon I can't support "outputCapture": "std" for extensionHost debugging because the extensionHost process is spawned by the vscode window, and the debugger doesn't have access to its stdout.

You should be able to configure one of those logging libraries to use console.log instead of something like process.stdout.write. That's what I'd recommend for now, our extension logging API may or may not have advanced features that you're looking for from a logging library.

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 9, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) extension-host Extension host issues extensions Issues concerning extensions
Projects
None yet
Development

No branches or pull requests

6 participants