Skip to content

feat: Make default MMKV log level configurable at build time#995

Merged
mrousavy merged 4 commits intomrousavy:mainfrom
tbrushwyler:feat/build-time-log-level
Mar 20, 2026
Merged

feat: Make default MMKV log level configurable at build time#995
mrousavy merged 4 commits intomrousavy:mainfrom
tbrushwyler:feat/build-time-log-level

Conversation

@tbrushwyler
Copy link
Copy Markdown
Contributor

Allow library consumers to override the default MMKV core log level via Gradle properties (Android) or Podfile variables (iOS).

Copy link
Copy Markdown
Owner

@mrousavy mrousavy left a comment

Choose a reason for hiding this comment

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

Thank you for this PR - this is great stuff!

I just have one change - can we not make the MMKV_LOG_LEVEL definition optional and instead always define it, but if it's not defined we use a default value (0 in debug, 3 in release)?

That way we can eliminate some of the conditionals here - always good to remove conditionals for predictability.

Comment thread README.md Outdated
tbrushwyler and others added 3 commits February 11, 2026 08:50
Allow library consumers to override the default MMKV core log level via Gradle properties (Android) or Podfile variables (iOS).
Co-authored-by: Marc Rousavy <me@mrousavy.com>
Simplify the log level logic by always defining MMKV_LOG_LEVEL with a default (0/Debug in debug builds, 3/Error in release) in the shared types header, removing the conditional branches from HybridMMKVFactory.cpp.
@tbrushwyler tbrushwyler force-pushed the feat/build-time-log-level branch from 0c391be to 72fd97e Compare February 11, 2026 13:50
@tbrushwyler
Copy link
Copy Markdown
Contributor Author

Thank you for this PR - this is great stuff!

I just have one change - can we not make the MMKV_LOG_LEVEL definition optional and instead always define it, but if it's not defined we use a default value (0 in debug, 3 in release)?

That way we can eliminate some of the conditionals here - always good to remove conditionals for predictability.

Good idea - I've moved this to MMKVTypes.hpp so that it's discoverable and falls back to the existing value, controlled by NITRO_DEBUG.

@tbrushwyler
Copy link
Copy Markdown
Contributor Author

@mrousavy could you re-trigger the Build iOS job? It looks like it failed for an unrelated reason:

https://github.com/mrousavy/react-native-mmkv/actions/runs/21909536593/job/63378522905?pr=995
Screenshot 2026-02-18 at 8 40 00 AM

@mrousavy mrousavy merged commit e43b3e0 into mrousavy:main Mar 20, 2026
8 of 9 checks passed
@mrousavy
Copy link
Copy Markdown
Owner

Awesome, thanks! LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants