Skip to content

Commit 1938e93

Browse files
committed
Expose the extension log functions that don't require a sourcepawn context
1 parent 72831b6 commit 1938e93

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

extshared/src/extension.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,16 @@ PLATFORM_EXTERN_C void cpp_report_error(IPluginContext* ctx, const char* err)
248248
ctx->ReportError("%s", err);
249249
}
250250

251+
PLATFORM_EXTERN_C void cpp_extension_log_message(const char* msg)
252+
{
253+
smutils->LogMessage(myself, "%s", msg);
254+
}
255+
256+
PLATFORM_EXTERN_C void cpp_extension_log_error(const char* err)
257+
{
258+
smutils->LogError(myself, "%s", err);
259+
}
260+
251261
PLATFORM_EXTERN_C void* cpp_local_to_phys_addr(IPluginContext* ctx, cell_t addr)
252262
{
253263
cell_t* phys_addr = NULL;

extshared/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ unsafe extern "C" {
5151

5252
pub fn cpp_report_error(ctx: NonNull<c_void>, err: *const u8);
5353

54+
pub unsafe fn cpp_extension_log_message(msg: *const u8);
55+
pub unsafe fn cpp_extension_log_error(msg: *const u8);
56+
5457
pub fn cpp_local_to_phys_addr(ctx: NonNull<c_void>, addr: i32) -> *mut u8;
5558
pub fn cpp_string_to_local_utf8(ctx: NonNull<c_void>, addr: i32, maxbytes: usize, s: *const u8) -> usize;
5659
}

0 commit comments

Comments
 (0)