Errors to stderr, debug output to stdout
This commit is contained in:
parent
ca261ca031
commit
73640c3b66
|
@ -1,6 +1,6 @@
|
|||
cmake_minimum_required (VERSION 3.7)
|
||||
project (expandurl-mastodon
|
||||
VERSION 0.2.1
|
||||
VERSION 0.2.2
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
|
|
|
@ -78,15 +78,15 @@ int main(int argc, char *argv[])
|
|||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
if (!listener.stillrunning())
|
||||
{
|
||||
cerr << "DEBUG: Reestablishing connection...\n";
|
||||
cout << "DEBUG: Reestablishing connection...\n";
|
||||
listener.start();
|
||||
}
|
||||
|
||||
for (Easy::Notification ¬if : listener.get_new_messages())
|
||||
{
|
||||
cerr << "DEBUG: new messages\n";
|
||||
cout << "DEBUG: new messages\n";
|
||||
const std::uint_fast64_t id = listener.get_parent_id(notif);
|
||||
cerr << "DEBUG: in_reply_to_id: " << id << '\n';
|
||||
cout << "DEBUG: in_reply_to_id: " << id << '\n';
|
||||
Easy::Status status;
|
||||
|
||||
if (id > 0)
|
||||
|
@ -103,7 +103,7 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
if (!listener.send_reply(notif.status(), message))
|
||||
{
|
||||
cerr << "FIXME!\n";
|
||||
cerr << "ERROR: could not send reply to " << id << '\n';
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "expandurl-mastodon.hpp"
|
||||
|
||||
using std::cerr;
|
||||
using std::cout;
|
||||
using std::string;
|
||||
|
||||
Listener::Listener()
|
||||
|
@ -61,7 +62,7 @@ const void Listener::start()
|
|||
masto.set_useragent(static_cast<const string>("expandurl-mastodon/") +
|
||||
global::version);
|
||||
masto.get_stream(Mastodon::API::v1::streaming_user, _stream, _ptr);
|
||||
cerr << "DEBUG: Connection lost.\n";
|
||||
cout << "DEBUG: Connection lost.\n";
|
||||
_running = false;
|
||||
});
|
||||
}
|
||||
|
@ -105,7 +106,7 @@ Mastodon::Easy::Status Listener::get_status(const std::uint_fast64_t &id)
|
|||
}
|
||||
else
|
||||
{
|
||||
cerr << "ERROR: " << ret << '\n';
|
||||
cerr << "ERROR: " << ret << " (in " << __FUNCTION__ << ")\n";
|
||||
return Easy::Status();
|
||||
}
|
||||
}
|
||||
|
@ -152,12 +153,12 @@ const bool Listener::send_reply(const Easy::Status &to_status,
|
|||
|
||||
if (ret == 0)
|
||||
{
|
||||
cerr << "DEBUG: Sent reply: " << message << '\n';
|
||||
cout << "DEBUG: Sent reply: " << message << '\n';
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "ERROR: could not send reply to " << id << '\n';
|
||||
cerr << "ERROR: " << ret << " (in " << __FUNCTION__ << ")\n";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user