electerious / electerious/ackee-tracker
Log ignored records/actions on localhost?
- Dominant language
- JavaScript
- Stars
- 206
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
Currently when `ignoreLocalhost` is set to false, there is a [single `console.warn` message](https://github.com/electerious/ackee-tracker/blob/master/src/scripts/main.js#L284) but no other info for troubleshooting your app. When you are new to Ackee or using it a new framework or pattern, it would be nice if you could get some indication of what would have been tracked. For example, you could `console.info` something like:
```
ackee record -
ackee record update -
ackee action -
ackee action update -
```
(unsure if the updates should be logged, but seems right at least for actions whose updates will be manually driven)
Would you accept a PR adding functionality along these lines? If so, design questions follow.
What is your preferred API for this?
- Expanding existing key: `ignoreLocalhost: true | false | 'log'` (most straightforward)
- New key: `ignoreLocalhostBehavior: 'log' | 'silent'` or `logOnIgnoreLocalhost: true | false` etc (or `verbose: true | false` which could be independent from ignore if people want this in prod for some reason)
Would you prefer updates be logged? Or just creates? Configurable (`logOnIgnoreLocalhost: 'create' | 'all' | false`)?
Would you prefer the logging instance augment all of the standard behavior? Maybe something like
```js
// new function with same API as send
const log = function(url, body, options, next) {
// probably inspect body.variables to determine what mutation type is happening, though could also parse query string
}
export const create = function(server, options) {
// added to body of create and replaces existing direct calls to `send` in this function
const _send = options.ignoreLocalhost === 'log' ? log : send;
...
```
I _think_ this is probably the right path forward for best simulation, and it means calls to `stop` don't need to be logged since the intervals will just stop happening.
This would also be useful in something like https://github.com/electerious/use-ackee/pull/10.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.