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

Logging future warning #65

Merged
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
## Describe your changes

## Issue number

Closes #X

## Checklist before requesting a review

- [ ] Performed a self-review of my code
- [ ] Formatted my code with [`pkgmt format`](https://ploomber-contributing.readthedocs.io/en/latest/contributing/pr.html#linting-formatting)
- [ ] Added [tests](https://ploomber-contributing.readthedocs.io/en/latest/contributing/pr.html#testing) (when necessary).
- [ ] Added [docstring](https://ploomber-contributing.readthedocs.io/en/latest/contributing/pr.html#documenting-changes-and-new-features) documentation and update the [changelog](https://ploomber-contributing.readthedocs.io/en/latest/contributing/pr.html#changelog) (when needed)

18 changes: 17 additions & 1 deletion src/ploomber_core/warnings.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from warnings import warn
from uuid import uuid4
import posthog


class PloomberDeprecationWarning(FutureWarning):
"""
Notes
Expand All @@ -6,4 +11,15 @@ class PloomberDeprecationWarning(FutureWarning):
Changed superclass from UserWarning to FutureWarning
"""

pass
# @
def __init__(self, message):
print("message: ", message)
self.message = message


def deprecation_warning(message):
warn(message, FutureWarning)
# log the event to posthog
posthog.project_api_key = "phc_JtG9P0pl0v0XExLqbqKfmXZjUm2wFq9cCxHE4LM74IG"
event_id = uuid4()
posthog.capture(event_id, "deprecation-warning-shown", {"message": message})