Skip to content

Conversation

@lposen
Copy link
Contributor

@lposen lposen commented Oct 10, 2025

🔹 JIRA Ticket(s) if any

✏️ Description

Changed the methods on the logger to be static, minimizing the need for circular dependencies.

Testing

  • Build the app with config.logReactNativeSdkCalls = true. Make sure the logs show.
  • Build the app with config.logReactNativeSdkCalls = false. Make sure the logs do not show.

@github-actions
Copy link

github-actions bot commented Oct 10, 2025

Lines Statements Branches Functions
Coverage: 56%
56.8% (309/544) 29.04% (61/210) 55.72% (112/201)

@qltysh
Copy link

qltysh bot commented Oct 10, 2025

Diff Coverage: The code coverage on the diff in this pull request is 93.9%.

Total Coverage: This PR will increase coverage by 4.67%.

File Coverage Changes
Path File Coverage Δ Indirect
src/core/classes/Iterable.ts 0.1
src/core/classes/IterableLogger.ts 25.0
🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

This is from Qlty Cloud, the successor to Code Climate Quality. Learn more.

@lposen lposen added the documentation Improvements or additions to documentation label Oct 10, 2025
@github-actions
Copy link

github-actions bot commented Oct 10, 2025

@lposen lposen added the jwt label Oct 14, 2025
@lposen lposen changed the title [MOB-12298] new-improve-logger [MOB-12298] Improve the logger Oct 14, 2025
@lposen lposen mentioned this pull request Oct 14, 2025
@lposen lposen marked this pull request as ready for review October 14, 2025 23:32
Base automatically changed from jwt/MOB-12231-create-an-iterableapi-class-for-api-calls to jwt/master October 16, 2025 00:20
@Ayyanchira Ayyanchira self-requested a review October 17, 2025 16:04
Copy link
Member

@Ayyanchira Ayyanchira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made two comments.

  1. The two config values for log
  2. Default state of logging

Comment on lines 25 to 31
test('should have default logging enabled', () => {
expect(IterableLogger.loggingEnabled).toBe(true);
});

test('should have default log level as info', () => {
expect(IterableLogger.logLevel).toBe(IterableLogLevel.info);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default should be debug. Info would add lot many logs and can be noisy

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that's totally fair. Changed it.

if (config) {
Iterable.savedConfig = config;

IterableLogger.setLoggingEnabled(config.logReactNativeSdkCalls ?? true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So whats the two log config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two config values that are set are:

  1. Whether anything is going to be logged at all (config.logReactNativeSdkCalls --> IterableLogger.loggingEnabled)
  2. If things are being logged, how granular those logs are going to be (config.logLevel --> IterableLogger.logLevel)

I think that's what you were asking. Let me know if I misinterpreted the question.

Comment on lines 205 to 229
return await Iterable.inAppManager?.getMessages().then((messagesObtained) => {
expect(messagesObtained).toEqual(messages);
});
return await Iterable.inAppManager
?.getMessages()
.then((messagesObtained) => {
expect(messagesObtained).toEqual(messages);
});
});

test('showMessage_messageAndConsume_returnsClickedUrl', async () => {
// GIVEN an in-app message and a clicked url
const messageDict = {
messageId: 'message1',
campaignId: 1234,
trigger: { type: IterableInAppTriggerType.immediate },
};
const message: IterableInAppMessage =
IterableInAppMessage.fromDict(messageDict);
const consume: boolean = true;
const clickedUrl: string = 'testUrl';

// WHEN the simulated clicked url is set to the clicked url
MockRNIterableAPI.setClickedUrl(clickedUrl);
// THEN Iterable,inAppManager.showMessage returns the simulated clicked url
return await Iterable.inAppManager?.showMessage(message, consume).then((url) => {
expect(url).toEqual(clickedUrl);
});
return await Iterable.inAppManager
?.showMessage(message, consume)
.then((url) => {
expect(url).toEqual(clickedUrl);
});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not logging related as such.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was automatically done by my automatic formatter :/

@lposen
Copy link
Contributor Author

lposen commented Oct 17, 2025

Made two comments.

  1. The two config values for log
  2. Default state of logging

@Ayyanchira Responded to these!

@Ayyanchira Ayyanchira self-requested a review October 17, 2025 19:24
Copy link
Member

@Ayyanchira Ayyanchira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good :)

@lposen lposen merged commit d695a8b into jwt/master Oct 17, 2025
3 of 6 checks passed
@lposen lposen deleted the jwt/MOB-12298-new-improve-logger branch October 17, 2025 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation jwt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants