Skip to content

Commit ecbd121

Browse files
committed
fix: pass variables from init to client
1 parent a155e1d commit ecbd121

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

posthog/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
set_code_variables_mask_patterns_context as inner_set_code_variables_mask_patterns_context,
1515
set_code_variables_ignore_patterns_context as inner_set_code_variables_ignore_patterns_context,
1616
)
17+
from posthog.exception_utils import (
18+
DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS,
19+
DEFAULT_CODE_VARIABLES_MASK_PATTERNS,
20+
)
1721
from posthog.feature_flags import InconclusiveMatchError, RequiresServerEvaluation
1822
from posthog.types import FeatureFlag, FlagsAndPayloads, FeatureFlagResult
1923
from posthog.version import VERSION
@@ -177,6 +181,10 @@ def tag(name: str, value: Any):
177181

178182
default_client = None # type: Optional[Client]
179183

184+
capture_exception_code_variables = False
185+
code_variables_mask_patterns = DEFAULT_CODE_VARIABLES_MASK_PATTERNS
186+
code_variables_ignore_patterns = DEFAULT_CODE_VARIABLES_IGNORE_PATTERNS
187+
180188

181189
# NOTE - this and following functions take unpacked kwargs because we needed to make
182190
# it impossible to write `posthog.capture(distinct-id, event-name)` - basically, to enforce
@@ -771,6 +779,9 @@ def setup() -> Client:
771779
enable_exception_autocapture=enable_exception_autocapture,
772780
log_captured_exceptions=log_captured_exceptions,
773781
enable_local_evaluation=enable_local_evaluation,
782+
capture_exception_code_variables=capture_exception_code_variables,
783+
code_variables_mask_patterns=code_variables_mask_patterns,
784+
code_variables_ignore_patterns=code_variables_ignore_patterns,
774785
)
775786

776787
# always set incase user changes it

0 commit comments

Comments
 (0)