Skip to content

Commit

Permalink
add a test script
Browse files Browse the repository at this point in the history
  • Loading branch information
hexylena committed Mar 8, 2024
1 parent 7267243 commit 7e88563
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions test/sentry-test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import sentry_sdk
import random
from sentry_sdk import capture_exception
from sentry_sdk import capture_message
from sentry_sdk import add_breadcrumb


n = random.choice([1, 1, 1, 1, 1, 2, 2, 3])

sentry_sdk.init(
dsn="http://gtn-py@localhost:8000/1",
# Enable performance monitoring
enable_tracing=True,
send_default_pii=True,
environment=random.choice(["development", "staging", "production"]),
release=f"[email protected].{n}"
)

add_breadcrumb(
category='auth',
message='Authenticated user %s' % 'hexylena',
level='info',
)

sentry_sdk.set_context("character", {
"name": "Mighty Fighter",
"age": 19,
"attack_type": "melee"
})


def b():
a_potentially_failing_function()

def a():
b()

try:
a()
except Exception as e:
# Alternatively the argument can be omitted
capture_exception(e)


# capture_message('Something went wrong')

0 comments on commit 7e88563

Please sign in to comment.