https://github.com/alienkevin/autolog
Automated logging for any language in VS Code
https://github.com/alienkevin/autolog
Last synced: over 1 year ago
JSON representation
Automated logging for any language in VS Code
- Host: GitHub
- URL: https://github.com/alienkevin/autolog
- Owner: AlienKevin
- License: mit
- Created: 2020-02-15T22:21:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T19:40:48.000Z (over 3 years ago)
- Last Synced: 2025-01-23T21:25:24.777Z (over 1 year ago)
- Language: TypeScript
- Homepage: https://marketplace.visualstudio.com/items?itemName=KevinLi.autolog
- Size: 1.26 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Auto Log

Automated logging for any language in VS Code.
# Features
By pressing shift+alt+l, you can **insert** a log message for different languages, formatted and indented.
By pressing shift+alt+c, you can **comment** out all log messages created by Auto Log.
By pressing shift+alt+u, you can **uncomment** out all log messages created by Auto Log.
# Extension Settings
- `autolog.languages`: list of log settings for each language
- `$eSEL`: escaped selection (`"`, `'`, `` ` `` are escaped)
- `$SEL`: non-escaped selection
Format:
```json
{
"": {
"wrapper": "<(Required) format of log messages>",
"match": "<(Required) regular expression matching a log message, used for commenting and uncommenting>. Reference the default regexps below on how to write one.",
"comment": "<(Required) single line comment symbol.>",
"prefix": "<(Optional) log prefix for this language.>"
}
}
```
Default value:
```json
{
"javascript": {
"wrapper": "console.log('$eSEL', $SEL)",
"match": "^(.*\\b)?console\\.log\\(([^)]*)\\);?.*$",
"comment": "//"
},
"typescript": {
"wrapper": "console.log('$eSEL', $SEL)",
"match": "^(.*\\b)?console\\.log\\(([^)]*)\\);?.*$",
"comment": "//"
},
"elm": {
"wrapper": "_ = Debug.log \"$eSEL\" <| $SEL",
"match": "^.*=\\s*(\n\\s*)?(\\-*\\s*)*Debug\\.log.*$",
"comment": "--",
"prefix": "AL -> "
},
"python": {
"wrapper": "print('$eSEL', $SEL)",
"match": "^(.*\\b)?print\\(([^)]*)\\).*$",
"comment": "#"
},
"default": {
"wrapper": "print($SEL);",
"match": "^(.*\\b)?print\\(([^)]*)\\).*$",
"comment": "//"
}
}
```
Default will be used if Auto Log doesn't find the log settings for the selected language. Follow the format to specify log settings for the languages you want that are not listed in the default value above. PRs are welcome for adding more default language log settings.
- `autolog.prefix`: Prefix used for all languages' logs, except those with `prefix` property defined in the `autolog.languages`.
Format: string
Default value: `"AL: "`
Set `autolog.prefix` to `""` (empty string) to produce unprefixed log messages. Note that Auto Log will now comment and uncomment all log messages in the file, regardless whether they are created using Auto Log.
# License
MIT
# Credit
- [Turbo Console Log](https://github.com/Chakroun-Anas/turbo-console-log)
- [Log Wrapper](https://github.com/chrisvltn/vs-code-log-wrapper)