Skip to content

Commit

Permalink
Log to stdout when sdk log method is used (#1265)
Browse files Browse the repository at this point in the history
### What

Resolves #734

Depends on stellar/rs-soroban-env#1411
  • Loading branch information
sisuresh authored May 3, 2024
1 parent d991ec7 commit cf4eb3d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ soroban-token-sdk = { version = "21.0.1-preview.1", path = "soroban-token-sdk" }
[workspace.dependencies.soroban-env-common]
version = "=21.0.1"
git = "https://github.com/stellar/rs-soroban-env"
rev = "df2c5f7cdcf7a323319872f7967014f3d7716d69"
rev = "ad83e6cef73ca04f75d03ad1b0f43434886ce93b"

[workspace.dependencies.soroban-env-guest]
version = "=21.0.1"
git = "https://github.com/stellar/rs-soroban-env"
rev = "df2c5f7cdcf7a323319872f7967014f3d7716d69"
rev = "ad83e6cef73ca04f75d03ad1b0f43434886ce93b"

[workspace.dependencies.soroban-env-host]
version = "=21.0.1"
git = "https://github.com/stellar/rs-soroban-env"
rev = "df2c5f7cdcf7a323319872f7967014f3d7716d69"
rev = "ad83e6cef73ca04f75d03ad1b0f43434886ce93b"

[workspace.dependencies.stellar-strkey]
version = "=0.0.8"
Expand Down
8 changes: 7 additions & 1 deletion soroban-sdk/src/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ impl Logs {
if cfg!(debug_assertions) {
let env = self.env();
env.log_from_slice(msg, args).unwrap();

#[cfg(any(test, feature = "testutils"))]
{
use crate::testutils::Logs;
std::println!("{}", self.all().last().unwrap());
}
}
}
}
Expand All @@ -143,7 +149,7 @@ impl testutils::Logs for Logs {
let log_sym = ScSymbol(StringM::try_from("log").unwrap());
let log_topics = ScVec(VecM::try_from(vec![ScVal::Symbol(log_sym)]).unwrap());
env.host()
.get_events()
.get_diagnostic_events()
.unwrap()
.0
.into_iter()
Expand Down

0 comments on commit cf4eb3d

Please sign in to comment.