Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/furstenheim/babel-plugin-meaningful-logs
Make your logs more descriptive
https://github.com/furstenheim/babel-plugin-meaningful-logs
Last synced: 5 days ago
JSON representation
Make your logs more descriptive
- Host: GitHub
- URL: https://github.com/furstenheim/babel-plugin-meaningful-logs
- Owner: furstenheim
- Created: 2016-07-23T21:02:00.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T21:45:03.000Z (about 2 years ago)
- Last Synced: 2024-05-01T14:19:14.101Z (8 months ago)
- Language: JavaScript
- Size: 183 KB
- Stars: 50
- Watchers: 4
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-babel - meaningful-logs - Adds file name and line number of caller to `console.log()` calls. (Plugins / Syntax Sugar)
README
Babel Plugin Meaningful Logs
======A babel plugin that enhances your logs by adding the file and the object logging.
### Example
```javascript
"use strict"
console.log(b.length)
```becomes
```javascript
"use strict"
console.log("pathToFile:2:8:b.length", b.length)
```### Configuration
#### Loggers
By default the plugin modifies all console commands: console.error, console.log... But it can be customized. To modify all winstons logs the .babelrc file would be:
```
{
plugins: [
['meaningful-logs',
{loggers: [{pattern: 'winston'}]}
]
]
}
```#### MaxDepth
It also logs the full path by default. This can be slightly annoying for really nested files.
In order to configure this use the the `maxDepth` property.
Which will limit the number of folders added to the path. For example:```
{
plugins: [
['meaningful-logs',
{maxDepth: 2}
]
]
}
```Will print `really-nested/file.js` instead of `test/src/nested/really-nested/file.js`
### Running the tests
yarn build
yarn test