hippware / rn-chat

MIT License
5 stars 0 forks source link

simpler logging solution for #4866 #4887

Closed southerneer closed 4 years ago

bengtan commented 4 years ago

Interesting.

1.

This PR breaks the rn-chat/wocky-client separation. Hence, I think we should decide on #4888 first (or at least, @aksonov to have a look) before deciding on this.

But if we choose to break the separation, then this PR is in the right direction.

2.

jest.mock is interesting and looks useful. Thanks. I didn't know about it.

3.

Alternatively, if we want to preserve the rn-chat/wocky-client separation, we can declare persistLog and notifyBugsnag as global functions (and stub them out in testuser.ts)

aksonov commented 4 years ago

LGTM, merging

southerneer commented 4 years ago

Alternatively, if we want to preserve the rn-chat/wocky-client separation, we can declare persistLog and notifyBugsnag as global functions (and stub them out in testuser.ts)

Creating new globals should be avoided as a general rule. It's difficult to be certain when they are available to be called and they can cause memory leaks since they are never garbage collected.