File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ pub(crate) mod common_generated {
2626}
2727
2828pub mod client_api;
29- #[ cfg( feature = "contract" ) ]
3029pub mod log;
3130#[ cfg( feature = "contract" ) ]
3231pub mod rand;
Original file line number Diff line number Diff line change 1+ #[ macro_export]
2+ macro_rules! info {
3+ ( $fmt: expr, $( $args: tt) * ) => {
4+ #[ cfg( not( feature="contract" ) ) ]
5+ tracing:: info!( $fmt, $( $args) * ) ;
6+ #[ cfg( feature="contract" ) ]
7+ info( & format!( $fmt, $( $args) * ) ) ;
8+ } ;
9+ }
10+
111pub fn info ( msg : & str ) {
212 let ptr = msg. as_ptr ( ) as _ ;
313 unsafe {
@@ -10,3 +20,13 @@ extern "C" {
1020 #[ doc( hidden) ]
1121 fn __frnt__logger__info ( id : i64 , ptr : i64 , len : i32 ) ;
1222}
23+
24+ #[ test]
25+ fn log_non_contract ( ) {
26+ use tracing:: level_filters:: LevelFilter ;
27+
28+ tracing_subscriber:: FmtSubscriber :: builder ( )
29+ . with_max_level ( LevelFilter :: INFO )
30+ . init ( ) ;
31+ info ! ( "n={}, y={:?}" , 1 , 2 ) ;
32+ }
You can’t perform that action at this time.
0 commit comments