https://github.com/zthxxx/dont-care-log
make git stage ignore specific log code line
https://github.com/zthxxx/dont-care-log
console-log console-plugin git-diff-ignore git-diff-plugin git-ignore-log git-ignore-plugin git-plugin ignore-console-log turbo-console-log
Last synced: 2 months ago
JSON representation
make git stage ignore specific log code line
- Host: GitHub
- URL: https://github.com/zthxxx/dont-care-log
- Owner: zthxxx
- License: mit
- Created: 2019-10-24T19:17:06.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-03T08:24:21.000Z (over 6 years ago)
- Last Synced: 2025-01-19T08:46:54.576Z (over 1 year ago)
- Topics: console-log, console-plugin, git-diff-ignore, git-diff-plugin, git-ignore-log, git-ignore-plugin, git-plugin, ignore-console-log, turbo-console-log
- Language: JavaScript
- Homepage: https://dont-care-log.zthxxx.me
- Size: 90.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dont-care-log
[](https://travis-ci.org/zthxxx/dont-care-log)
[](https://www.npmjs.com/package/dont-care-log)
[](https://www.npmjs.com/package/dont-care-log)
[](https://nodejs.org)
[](https://github.com/zthxxx/dont-care-log/blob/master/LICENSE)
Teach git stage/diff how to **ignore specific logging code**,
so your logging code will never be commit automatically,
of course also wont show dirty in `git`.
## Example
Assuming that a **new file** in you project like:
```js
import path from 'path'
const getFile = () => {
const name = 'foo'
const file = path.join(__dirname, name)
console.log('TCL: getFile() -> name:', file)
return file
}
```
and with installed [**dont-care-log**](https://www.npmjs.com/package/dont-care-log), you will only see this output below on **`git status/add/diff`** commands
```diff
+ import path from 'path'
+
+ const getFile = () => {
+ const name = 'foo'
+ const file = path.join(__dirname, name)
+ return file
+ }
```
Amazing, there is no line of `console.log('TCL: ...)`
## Install
```bash
npm i -D dont-care-log
```
and [**Turbo Console Log**](https://marketplace.visualstudio.com/items?itemName=ChakrounAnas.turbo-console-log) for VSCode
## How it works
[**dont-care-log**](https://www.npmjs.com/package/dont-care-log) only teach git to ignore the specific format line which is prefixed with any spaces and `console.log('TCL:` (default format of [**Turbo Console Log**](https://marketplace.visualstudio.com/items?itemName=ChakrounAnas.turbo-console-log)).
Well, here defined a **`filter.clean`** pipe to drop the specific line (generated by Turbo-Console-Log),
and some `preinstall` hook to setup `.gitconfig` and `.gitattributes`.
More details of `git add/staging` workflow see: [> git-scm staging](https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes#_keyword_expansion)
In simple terms, `filter.clean` for **staging**, `filter.smudge` **for checkout**


## Next
- [ ] multiline for per log functions
- [ ] configurable
- [ ] static parse current line to find out all variables
- [ ] log plugin of webstorm
## License
[MIT LICENSE](./LICENSE)