Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Auto LogNew to Visual Studio Code? Get it now.
Auto Log

Auto Log

Willster Johnson

|
821 installs
| (0) | Free
Log anything in development. Log nothing in production.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Auto Log

Log anything in development. Log nothing in production.

Features

Extension Settings

Known Issues

Goals

Commands:

  • [ ] auto detect & log all variable assignments
  • [ ] remove all logs
  • [ ] add single log
  • [ ] remove single log
  • [ ] add log to all assignments to variable
  • [ ] remove log for variable

Options:

  • [ ] {string | { [fileExt: string]: string }} [logFunction="console.log"] - the function to use when logging. Can be configured on a filetype basis.
  • [ ] {string | false} [wrapMessage=false] - logs the given string before and after the debug statement, each on separate lines
  • [ ] {string} [prefix="AUTOLOG"] - inserts the given string at the beginning of the debug statement
  • [ ] {"vscode" | "long" | "short"} [locationFormat="vscode"] - specifies the format of the location information (file name & line number)
    • vscode - filename#lineNum
    • long - file: filename line: lineNum
    • short - filename lineNum
  • [ ] {"default" | "annotation" | string} [appearance="default"] - how the log is displayed in the file (does not effect the log output)
    • default - the log is displayed as it is written; a normal console.log call (or specified logFunction) is displayed
    • annotation - the inserted code is hidden and is shown as an annotation reading autolog(varName)
    • string - similar to annotation, but the annotation content is specified by the string. Adding ${varName} will substitute the variable name

LogFormat:

// readable summarization
logFunction(`prefix | locationFormat | varName ${varName}`);
// implementation
`${logFunction}(\`${prefix} | ${
  locationFormat === "vscode"
  ? `${fileName}#${lineNum}`
  : locationFormat === "long" 
    ? `file: ${fileName}, line: ${lineNum}`
    : `${fileName} ${lineNum}`
  } | ${varName}: \${varName}\`);`

Release Notes

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft