|
| 1 | +//! Includes testing for logging |
| 2 | +// ANCHOR: contractifce |
| 3 | +use freenet_stdlib::{info, prelude::*}; |
| 4 | + |
| 5 | +pub const RANDOM_SIGNATURE: &[u8] = &[6, 8, 2, 5, 6, 9, 9, 10]; |
| 6 | + |
| 7 | +struct Contract; |
| 8 | + |
| 9 | +#[contract] |
| 10 | +impl ContractInterface for Contract { |
| 11 | + fn validate_state( |
| 12 | + _parameters: Parameters<'static>, |
| 13 | + _state: State<'static>, |
| 14 | + _related: RelatedContracts<'static>, |
| 15 | + ) -> Result<ValidateResult, ContractError> { |
| 16 | + unimplemented!() |
| 17 | + } |
| 18 | + |
| 19 | + fn update_state( |
| 20 | + _parameters: Parameters<'static>, |
| 21 | + _state: State<'static>, |
| 22 | + _data: Vec<UpdateData<'static>>, |
| 23 | + ) -> Result<UpdateModification<'static>, ContractError> { |
| 24 | + info!("state update"); |
| 25 | + todo!() |
| 26 | + } |
| 27 | + |
| 28 | + fn summarize_state( |
| 29 | + _parameters: Parameters<'static>, |
| 30 | + _state: State<'static>, |
| 31 | + ) -> Result<StateSummary<'static>, ContractError> { |
| 32 | + unimplemented!() |
| 33 | + } |
| 34 | + |
| 35 | + fn get_state_delta( |
| 36 | + _parameters: Parameters<'static>, |
| 37 | + _state: State<'static>, |
| 38 | + _summary: StateSummary<'static>, |
| 39 | + ) -> Result<StateDelta<'static>, ContractError> { |
| 40 | + unimplemented!() |
| 41 | + } |
| 42 | +} |
| 43 | +// ANCHOR_END: contractifce |
| 44 | + |
| 45 | +fn main() {} |
| 46 | + |
| 47 | +#[test] |
| 48 | +fn test_log() { |
| 49 | + use tracing::level_filters::LevelFilter; |
| 50 | + |
| 51 | + tracing_subscriber::FmtSubscriber::builder() |
| 52 | + .with_max_level(LevelFilter::INFO) |
| 53 | + .init(); |
| 54 | + info!("state update"); |
| 55 | +} |
0 commit comments