Skip to content

Logging in Extension #2156

Closed
Closed

Description

Goal: Improved logging within the extension for diagnostics

Resources:

  • VSC provides logging API (currently in preview)
  • Different log levels provided by VSC include:
		Trace = 1,
		Debug = 2,
		Info = 3,
		Warning = 4,
		Error = 5,
		Critical = 6,
		Off = 7

Definitions:

  • Critical = Contribute to extension not functioning at all, or something that must be fixed.
  • Error = Contribute to features that may/may not function
  • Warning = Indication of a feature that may not function correctly
  • Info = Messages that will be generally useful for users
  • Debug = Debug messages (for diagnostics)
  • Trace = Everything (for diagnostics)

Requirements:

  • Use VSC api as the backing store for logs (today we log into console window and output panel)
  • Decide what must be logged and what categories each log message fall under
  • Document how users can change log level
  • Document how users can capture log output (for issues)
  • Determine default log levels of VS Code (ideally i'd like to see info and above)

Generic logs and log levels:

  • All external (process) commands executed must be logged with status of Info
  • All errors encountered must be logged with status of Error (even if error is displayed to the user)
  • Output of commands should be logged at a level of Debug (e.g. Linting, Testing, formatting, etc)

Formatting

  • Logging formatting output would be an exception. The output is generally a diff of the entire file. So, the output could be as large/larger than size of file.
  • Discuss:
    • Log level to view this output
    • Or should we have a special switch for this, i.e. output this?

Linting

Environments

  • Exception when conda cannot be found (we know whether conda exists by trying to run conda command)
    • Log level for these errors = Debug

Environments

  • Errors in detecting pipenv, conda, etc = Trace

@Microsoft/pvsc-team

  • Please feel free to add a list of items that need to be logged along with the log level

Process Output

  • Log all process output that will be subsequently parsed/processed.
    E.g. when getting linting output from pylint, log that output to the console window. Log all output.

Activity

  1. DonJayamanne commented on Jun 18, 2019

    @DonJayamanne
    Author

    Got those subscribed to this issue, VSC have removed the logging API in their insiders build. They have only exposed log levels.
    My suggestion, let's not wait for their API, just keep using what we have (Winston logging package) but we could perhaps implement the log levels, categories and the like...

  2. luabud commented on Apr 8, 2020

    @luabud
    Member

    Related to #8527.

  3. kimadeline commented on Oct 21, 2021

    @kimadeline

    Partially addressed by #9837 #11699, closing in favor of #13076.

  4. locked as resolved and limited conversation to collaborators on Nov 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-diagnosticsLogging/Features to facilitate diagnosing user problemsdebtCode quality issues

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions