Skip to content

Commit

Permalink
[ssh] lower ssh process log messages level
Browse files Browse the repository at this point in the history
  • Loading branch information
sharder996 committed Oct 27, 2023
1 parent 6984b5b commit dfeb421
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/ssh/ssh_process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,19 @@ std::string mp::SSHProcess::read_std_error()

std::string mp::SSHProcess::read_stream(StreamType type, int timeout)
{
mpl::log(mpl::Level::debug, category,
fmt::format("{}:{} {}(type = {}, timeout = {}): ", __FILE__, __LINE__, __FUNCTION__,
static_cast<int>(type), timeout));
mpl::log(mpl::Level::trace,
category,
fmt::format("{}:{} {}(type = {}, timeout = {}): ",
__FILE__,
__LINE__,

Check warning on line 121 in src/ssh/ssh_process.cpp

View check run for this annotation

Codecov / codecov/patch

src/ssh/ssh_process.cpp#L121

Added line #L121 was not covered by tests
__FUNCTION__,
static_cast<int>(type),
timeout));
// If the channel is closed there's no output to read
if (ssh_channel_is_closed(channel.get()))
{
mpl::log(mpl::Level::debug, category,
mpl::log(mpl::Level::trace,
category,
fmt::format("{}:{} {}(): channel closed", __FILE__, __LINE__, __FUNCTION__));
return std::string();
}
Expand All @@ -132,14 +138,16 @@ std::string mp::SSHProcess::read_stream(StreamType type, int timeout)
do
{
num_bytes = ssh_channel_read_timeout(channel.get(), buffer.data(), buffer.size(), is_std_err, timeout);
mpl::log(mpl::Level::debug, category,
mpl::log(mpl::Level::trace,
category,
fmt::format("{}:{} {}(): num_bytes = {}", __FILE__, __LINE__, __FUNCTION__, num_bytes));
if (num_bytes < 0)
{
// Latest libssh now returns an error if the channel has been closed instead of returning 0 bytes
if (ssh_channel_is_closed(channel.get()))
{
mpl::log(mpl::Level::debug, category,
mpl::log(mpl::Level::trace,
category,
fmt::format("{}:{} {}(): channel closed", __FILE__, __LINE__, __FUNCTION__));
return output.str();
}
Expand Down

0 comments on commit dfeb421

Please sign in to comment.