diff options
author | dan <dan.abramov@gmail.com> | 2024-07-09 21:13:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-09 21:13:32 +0100 |
commit | 7a476568168fa897d3dc9fcae3c1f77d4363366e (patch) | |
tree | 765b4c7ae1400f61cd01062b519488c945cd21cd /src/state/session/logging.ts | |
parent | 2d0eefebc338eee0d5d7e3e4c02bd6bba7f6baa0 (diff) | |
download | voidsky-7a476568168fa897d3dc9fcae3c1f77d4363366e.tar.zst |
Log session events unconditionally (#4758)
Diffstat (limited to 'src/state/session/logging.ts')
-rw-r--r-- | src/state/session/logging.ts | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/state/session/logging.ts b/src/state/session/logging.ts index 16aa66fe7..ab67785ca 100644 --- a/src/state/session/logging.ts +++ b/src/state/session/logging.ts @@ -1,4 +1,4 @@ -import {AtpSessionData} from '@atproto/api' +import {AtpSessionData, AtpSessionEvent} from '@atproto/api' import {sha256} from 'js-sha256' import {Statsig} from 'statsig-react-native-expo' @@ -70,6 +70,18 @@ export function wrapSessionReducerForLogging(reducer: Reducer): Reducer { let nextMessageIndex = 0 const MAX_SLICE_LENGTH = 1000 +// Not gated. +export function addSessionEventLog(did: string, event: AtpSessionEvent) { + try { + if (!Statsig.initializeCalled() || !Statsig.getStableID()) { + return + } + Statsig.logEvent('session:event', null, {did, event}) + } catch (e) { + console.error(e) + } +} + export function addSessionDebugLog(log: Log) { try { if (!Statsig.initializeCalled() || !Statsig.getStableID()) { |