Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate analytics events and logging from the same call #60

Open
nbrooke opened this issue Jun 12, 2020 · 0 comments
Open

Generate analytics events and logging from the same call #60

nbrooke opened this issue Jun 12, 2020 · 0 comments

Comments

@nbrooke
Copy link
Member

nbrooke commented Jun 12, 2020

Lots of (maybe all) times we are doing an analytics event we ALSO want to be logging something. We should tweak the analytics tracking so that it can automatically log the analytics events in some way as well.

Minimally, any analytics call should also (by default) cause the analytics event to get logged to the verbose logging level (though maybe there should be a way to turn this behaviour of globally and/or for a particular track call).

It might also be worth having some approach that we can easily log a warning/error and an analytics event in a single call. This could be either changing the analytics tracking method to take a log level (clog.track(id: "purchaseFailed", log: .warning)), change the warn/error methods to take a flag to enable analytics (clog.error("purchaseFailed", analytics:true)) or add some new methods specifically for this (clog.trackError("purchaseFailed")).

I think I mildly prefer the first option (analytics methods that takes a log level). It looks the cleanest to me, doesn't have the issue the other two do of maybe ending up with "bad" analytics events names if people are using normal log text as the event name, and has the nice advantage of also providing a reasonable way to turn off the default logging for a particular call with the same signature (clog.track(id: "eventWeDontWantToLog", log: .none))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant