Browse Source

Errors to stderr, debug output to stdout

tags/0.2.2
tastytea 2 years ago
parent
commit
73640c3b66
Signed by: tastytea GPG Key ID: 59346E0EA35C67E5
3 changed files with 10 additions and 9 deletions
  1. +1
    -1
      CMakeLists.txt
  2. +4
    -4
      src/main.cpp
  3. +5
    -4
      src/masto.cpp

+ 1
- 1
CMakeLists.txt View File

@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (expandurl-mastodon
VERSION 0.2.1
VERSION 0.2.2
LANGUAGES CXX
)



+ 4
- 4
src/main.cpp View File

@@ -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 &notif : 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


+ 5
- 4
src/masto.cpp View File

@@ -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…
Cancel
Save