Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
c14b3ef
[NativeAOT] Add printf-style native logging
simonrozsival Jul 16, 2026
90e6fb6
[native] Test printf-style logging
simonrozsival Jul 17, 2026
2cb0c4e
[Tests] Follow Android string helper convention
simonrozsival Jul 17, 2026
4a27f68
[Tests] Import Android string helpers
simonrozsival Jul 17, 2026
ee07100
[Tests] Remove native logging test harness
simonrozsival Jul 17, 2026
c907892
[NativeAOT] Migrate runtime utility logging to printf
simonrozsival Jul 17, 2026
7a34259
[CoreCLR/NativeAOT] Migrate configuration diagnostics to printf
simonrozsival Jul 17, 2026
a1bf4b7
Address printf logging review feedback
simonrozsival Jul 17, 2026
2e31630
Merge updated printf logging base
simonrozsival Jul 17, 2026
3b8673f
Merge updated printf logging base
simonrozsival Jul 17, 2026
09f0690
Support printf logging helpers on MonoVM
simonrozsival Jul 17, 2026
66d731d
Merge MonoVM printf logging support
simonrozsival Jul 17, 2026
88ca523
Merge MonoVM printf logging support
simonrozsival Jul 17, 2026
72cad5d
Use printf configuration logging on MonoVM
simonrozsival Jul 17, 2026
00aa7d4
Centralize native printf logging declarations
jonathanpeppers Jul 20, 2026
fcd87d4
Reuse NativeAOT bridge status strings
jonathanpeppers Jul 20, 2026
1c244d8
Merge main into native printf logging
jonathanpeppers Jul 20, 2026
71cfe50
Use canonical printf logging declarations
jonathanpeppers Jul 20, 2026
f28e855
Preserve mmap diagnostic alignment
jonathanpeppers Jul 21, 2026
b8f2e27
Merge PR 12155 for stacked review
jonathanpeppers Jul 21, 2026
23fa284
Merge branch 'main' into dev/simonrozsival/nativeaot-runtime-printf-l…
jonathanpeppers Jul 21, 2026
d11efec
Update CoreCLR APK size reference
jonathanpeppers Jul 22, 2026
fce7aeb
Merge branch 'main' into dev/simonrozsival/nativeaot-runtime-printf-l…
jonathanpeppers Jul 22, 2026
4952d57
[NativeAOT] Migrate shared GC logging to printf
jonathanpeppers Jul 22, 2026
470c947
Avoid string_view for segment errors
jonathanpeppers Jul 22, 2026
1ae4c40
Make segment error mapping constexpr
jonathanpeppers Jul 22, 2026
e23506f
Merge branch 'main' into jonathanpeppers-native-printf-logging-next
jonathanpeppers Jul 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/native/clr/host/bridge-processing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TemporaryPeerMap::TemporaryPeerMap (JNIEnv *jni_env, MarkCrossReferencesArgs *ar

if (env->EnsureLocalCapacity (requested_capacity) != JNI_OK) [[unlikely]] {
env->ExceptionClear ();
log_warn (LOG_GC, "Failed to reserve JNI local reference capacity for {} temporary peers", map_capacity);
log_warnf (LOG_GC, "Failed to reserve JNI local reference capacity for %zu temporary peers", map_capacity);
}

capacity = map_capacity;
Expand Down Expand Up @@ -470,7 +470,7 @@ void BridgeProcessingShared::log_missing_add_references_method ([[maybe_unused]]
}

char *class_name = Host::get_java_class_name_for_TypeManager (java_class);
log_error (LOG_GC, "Missing monodroidAddReferences method for object of class {}", optional_string (class_name));
log_errorf (LOG_GC, "Missing monodroidAddReferences method for object of class %s", optional_string (class_name));
free (class_name);
#endif
}
Expand All @@ -486,7 +486,7 @@ void BridgeProcessingShared::log_missing_clear_references_method ([[maybe_unused
}

char *class_name = Host::get_java_class_name_for_TypeManager (java_class);
log_error (LOG_GC, "Missing monodroidClearReferences method for object of class {}", optional_string (class_name));
log_errorf (LOG_GC, "Missing monodroidClearReferences method for object of class %s", optional_string (class_name));
free (class_name);
#endif
}
Expand Down Expand Up @@ -594,5 +594,5 @@ void BridgeProcessingShared::log_gc_summary () noexcept
}
}

log_info (LOG_GC, "GC cleanup summary: {} objects tested - resurrecting {}.", total, alive);
log_infof (LOG_GC, "GC cleanup summary: %zu objects tested - resurrecting %zu.", total, alive);
}
10 changes: 8 additions & 2 deletions src/native/clr/runtime-base/logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ auto Logger::open_file (LogCategories category, std::string_view const& custom_p
{
auto log_and_return = [&category](FILE *f, std::string_view const& path) -> FILE* {
if (f != nullptr) {
log_debug (category, "Opened file '{}' for logging.", path);
log_debugf (category, "Opened file '%.*s' for logging.", static_cast<int>(path.length ()), path.data ());
}
return f;
};
Expand Down Expand Up @@ -193,7 +193,13 @@ Logger::init_logging_categories () noexcept
auto file_name = segment.at (offset);

if (!file_name.has_value ()) {
log_warn (LOG_DEFAULT, "Unable to set path to {} log file: {}", file_kind, to_string (file_name.error ()));
log_warnf (
LOG_DEFAULT,
"Unable to set path to %.*s log file: %s",
static_cast<int>(file_kind.length ()),
file_kind.data (),
to_string (file_name.error ())
);
return {};
}

Expand Down
8 changes: 3 additions & 5 deletions src/native/common/include/runtime-base/strings.hh
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@ namespace xamarin::android {
index_out_of_range,
};

static inline auto to_string (string_segment_error error) -> std::string_view const
static constexpr auto to_string (string_segment_error error) -> const char*
{
using std::operator""sv;

switch (error) {
case string_segment_error::index_out_of_range:
return "Index out of range"sv;
return "Index out of range";

default:
return "Unknown error"sv;
return "Unknown error";
}
}

Expand Down
Loading