Skip to main content

xmtp_common/
event_logging.rs

1mod utils;
2pub use utils::*;
3
4#[xmtp_macro::build_logging_metadata]
5pub enum Event {
6    // ===================== General Client =====================
7    /// Client created.
8    #[context(device_sync_enabled, disabled_workers, inbox_id, icon = "⬆️")]
9    ClientCreated,
10    /// Client dropped.
11    #[context(icon = "⬇️")]
12    ClientDropped,
13    /// Client cleanly closed via `Client::close`.
14    #[context(icon = "🔒")]
15    ClientClosed,
16    /// Associating name with installation.
17    #[context(name)]
18    AssociateName,
19
20    // ===================== Group Operations =====================
21    /// DM created.
22    #[context(group_id, target_inbox)]
23    CreatedDM,
24    /// Group created.
25    #[context(group_id)]
26    CreatedGroup,
27    /// Added members to group.
28    #[context(group_id, members, epoch, icon = "➕")]
29    AddedMembers,
30    /// Received new group from welcome.
31    #[context(group_id, conversation_type, epoch, epoch_auth, icon = "🤝")]
32    ReceivedWelcome,
33
34    // ===================== MLS Operations =====================
35    /// Received staged commit. Merging and clearing any pending commits.
36    #[context(
37        group_id,
38        sender_installation_id,
39        message_epoch,
40        epoch,
41        hash,
42        icon = "❗"
43    )]
44    MLSReceivedStagedCommit,
45    /// Processed staged commit.
46    #[context(
47        group_id,
48        actor_installation_id,
49        epoch,
50        epoch_auth,
51        added_inboxes,
52        removed_inboxes,
53        left_inboxes,
54        metadata_changes,
55        cursor,
56        icon = "😮‍💨"
57    )]
58    MLSProcessedStagedCommit,
59    /// Received application message.
60    #[context(group_id, epoch, message_epoch, sender_inbox_id)]
61    MLSReceivedApplicationMessage,
62
63    // ===================== Network =====================
64    /// Stream started.
65    #[context(kind, icon = "🌊")]
66    StreamOpened,
67    /// Stream closed.
68    #[context(kind, icon = "🏜️")]
69    StreamClosed,
70
71    // ===================== Group Syncing =====================
72    /// Begin syncing group.
73    #[context(group_id, icon = "🔄")]
74    GroupSyncStart,
75    /// Syncing group.
76    #[context(group_id, attempt, backoff, icon = "🔃")]
77    GroupSyncAttempt,
78    /// Group sync complete.
79    #[context(group_id, summary, success, icon = "✅")]
80    GroupSyncFinished,
81    /// Attempted to sync on an inactive group.
82    #[context(group_id, icon = "⏸️")]
83    GroupSyncGroupInactive,
84    /// Intent failed to sync and will be retried.
85    #[context(group_id, intent_id, intent_kind, state, icon = "🔁")]
86    GroupSyncIntentRetry,
87    /// Intent was found to be in error after attempting to sync.
88    /// The summary is logged once by `GroupSyncFinished`; this only marks
89    /// which intent errored.
90    #[context(group_id, intent_id, intent_kind, icon = "⚠️")]
91    GroupSyncIntentErrored,
92    /// Attempt to publish intent failed.
93    #[context(group_id, intent_id, intent_kind, error, icon = "❌")]
94    GroupSyncPublishFailed,
95    /// Application message published successfully.
96    #[context(group_id, intent_id, icon = "📤")]
97    GroupSyncApplicationMessagePublishSuccess,
98    /// Commit published successfully.
99    #[context(group_id, intent_id, intent_kind, commit_hash, icon = "✨")]
100    GroupSyncCommitPublishSuccess,
101    /// Commit sent. Staged commit is present. Stopping further publishes for this round.
102    #[context(group_id, hash, icon = "🛑")]
103    GroupSyncStagedCommitPresent,
104    /// Updating group cursor.
105    #[context(group_id, cursor, icon = "📍")]
106    GroupCursorUpdate,
107
108    // ===================== Group Membership =====================
109    /// Updated group membership.
110    #[context(group_id, added_installations, removed_installations, icon = "🫂")]
111    UpdatedGroupMembership,
112
113    // ===================== Device Sync =====================
114    /// Device Sync worker initializing.
115    DeviceSyncInitializing,
116    /// Device sync initialized.
117    DeviceSyncInitializingFinished,
118    /// No primary sync group found.
119    DeviceSyncNoPrimarySyncGroup,
120    /// Created primary sync group.
121    #[context(group_id)]
122    DeviceSyncCreatedPrimarySyncGroup,
123    /// Processing new sync message.
124    #[context(msg_type, external, message_id, group_id)]
125    DeviceSyncProcessingMessages,
126    /// Failed to process device sync message.
127    #[context(message_id, error)]
128    DeviceSyncMessageProcessingError,
129}