Skip to content

Commit a5fd165

Browse files
committed
Remove log module
1 parent ad64362 commit a5fd165

File tree

3 files changed

+9
-202
lines changed

3 files changed

+9
-202
lines changed

sdk/pinocchio/src/entrypoint/mod.rs

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -434,35 +434,10 @@ pub unsafe fn deserialize<const MAX_ACCOUNTS: usize>(
434434
(program_id, processed, instruction_data)
435435
}
436436

437-
/// Default panic hook.
438-
///
439-
/// This macro sets up a default panic hook that logs the panic message and the file where the panic
440-
/// occurred. It acts as a hook after Rust runtime panics; syscall `abort()` will be called after it
441-
/// returns.
442-
///
443-
/// Note that this requires the `"std"` feature to be enabled.
444-
#[cfg(feature = "std")]
445-
#[macro_export]
446-
macro_rules! default_panic_handler {
447-
() => {
448-
/// Default panic handler.
449-
#[cfg(target_os = "solana")]
450-
#[no_mangle]
451-
fn custom_panic(info: &core::panic::PanicInfo<'_>) {
452-
// Panic reporting.
453-
$crate::msg!("{}", info);
454-
}
455-
};
456-
}
457-
458437
/// Default panic hook.
459438
///
460439
/// This macro sets up a default panic hook that logs the file where the panic occurred. It acts as
461440
/// a hook after Rust runtime panics; syscall `abort()` will be called after it returns.
462-
///
463-
/// This is used when the `"std"` feature is disabled, while either the program or any of its
464-
/// dependencies are not `no_std`.
465-
#[cfg(not(feature = "std"))]
466441
#[macro_export]
467442
macro_rules! default_panic_handler {
468443
() => {
@@ -471,10 +446,12 @@ macro_rules! default_panic_handler {
471446
#[no_mangle]
472447
fn custom_panic(info: &core::panic::PanicInfo<'_>) {
473448
if let Some(location) = info.location() {
474-
$crate::log::sol_log(location.file());
449+
let location = location.file();
450+
unsafe { $crate::syscalls::sol_log_(location.as_ptr(), location.len() as u64) };
475451
}
476452
// Panic reporting.
477-
$crate::log::sol_log("** PANICKED **");
453+
const PANICKED: &str = "** PANICKED **";
454+
unsafe { $crate::syscalls::sol_log_(PANICKED.as_ptr(), PANICKED.len() as u64) };
478455
}
479456
};
480457
}
@@ -505,8 +482,11 @@ macro_rules! nostd_panic_handler {
505482
}
506483
} else {
507484
// Panic reporting.
508-
$crate::log::sol_log("** PANICKED **");
509-
unsafe { $crate::syscalls::abort() }
485+
const PANICKED: &str = "** PANICKED **";
486+
unsafe {
487+
$crate::syscalls::sol_log_(PANICKED.as_ptr(), PANICKED.len() as u64);
488+
$crate::syscalls::abort();
489+
}
510490
}
511491
}
512492

sdk/pinocchio/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@
227227
extern crate std;
228228

229229
pub mod entrypoint;
230-
pub mod log;
231230
pub mod syscalls;
232231
pub mod sysvars;
233232

sdk/pinocchio/src/log.rs

Lines changed: 0 additions & 172 deletions
This file was deleted.

0 commit comments

Comments
 (0)