Skip to content

Commit cc28c89

Browse files
authored
[native] Use correct log functions for std::format to work (#10035)
Context: https://discord.com/channels/732297728826277939/732297837953679412/1361743322586157116 The `Failed to load shared library` message is currently useless, because of incorrect `std::format` usage: I monodroid-assembly: Failed to load shared library '{}'. {} Review `log_*()` calls and audit `std::format` usage so that we get the complete messages we expect to see.
1 parent 829b6c9 commit cc28c89

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

src/native/clr/runtime-base/android-system.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ auto AndroidSystem::load_dso (const char *path, unsigned int dl_flags, bool skip
441441
char *error = nullptr;
442442
void *handle = java_interop_lib_load (path, dl_flags, &error);
443443
if (handle == nullptr && Util::should_log (LOG_ASSEMBLY)) {
444-
log_info_nocheck (LOG_ASSEMBLY, "Failed to load shared library '{}'. {}", path, error);
444+
log_info_nocheck_fmt (LOG_ASSEMBLY, "Failed to load shared library '{}'. {}", path, error);
445445
}
446446
java_interop_free (error);
447447
return handle;

src/native/common/include/shared/cpp-util.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ abort_if_negative_integer_argument (int arg, const char *arg_name, std::source_l
142142
[[gnu::always_inline]]
143143
inline void pd_log_location (std::source_location sloc = std::source_location::current ()) noexcept
144144
{
145-
log_info_nocheck (LOG_DEFAULT, "loc: {}:{} ('{}')", sloc.file_name (), sloc.line (), sloc.function_name ());
145+
log_warn (LOG_DEFAULT, "loc: {}:{} ('{}')", sloc.file_name (), sloc.line (), sloc.function_name ());
146146
}
147147

148148
namespace xamarin::android

src/native/mono/runtime-base/android-system.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ AndroidSystem::load_dso (const char *path, unsigned int dl_flags, bool skip_exis
315315
char *error = nullptr;
316316
void *handle = java_interop_lib_load (path, dl_flags, &error);
317317
if (handle == nullptr && Util::should_log (LOG_ASSEMBLY))
318-
log_info_nocheck (LOG_ASSEMBLY, "Failed to load shared library '{}'. {}", path, error);
318+
log_info_nocheck_fmt (LOG_ASSEMBLY, "Failed to load shared library '{}'. {}", path, error);
319319
java_interop_free (error);
320320
return handle;
321321
}

src/native/mono/shared/cpp-util.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ abort_if_negative_integer_argument (int arg, const char *arg_name, std::source_l
142142
// of the calls present.
143143
force_inline inline void pd_log_location (std::source_location sloc = std::source_location::current ()) noexcept
144144
{
145-
log_info_nocheck (LOG_DEFAULT, "loc: {}:{} ('{}')", sloc.file_name (), sloc.line (), sloc.function_name ());
145+
log_warn (LOG_DEFAULT, "loc: {}:{} ('{}')", sloc.file_name (), sloc.line (), sloc.function_name ());
146146
}
147147

148148
namespace xamarin::android

0 commit comments

Comments
 (0)