Skip to content

Commit

Permalink
cli: Ignore libevent warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Cory Fields authored and furszy committed Nov 11, 2021
1 parent 3b8077e commit b4de8aa
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/pivx-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,18 @@ std::string HelpMessageCli()
return strUsage;
}

/** libevent event log callback */
static void libevent_log_cb(int severity, const char *msg)
{
#ifndef EVENT_LOG_ERR // EVENT_LOG_ERR was added in 2.0.19; but before then _EVENT_LOG_ERR existed.
# define EVENT_LOG_ERR _EVENT_LOG_ERR
#endif
// Ignore everything other than errors
if (severity >= EVENT_LOG_ERR) {
throw std::runtime_error(strprintf("libevent error: %s", msg));
}
}

//////////////////////////////////////////////////////////////////////////////
//
// Start
Expand Down Expand Up @@ -359,6 +371,7 @@ int main(int argc, char* argv[])
fprintf(stderr, "Error: Initializing networking failed\n");
return EXIT_FAILURE;
}
event_set_log_callback(&libevent_log_cb);

try {
if (!AppInitRPC(argc, argv))
Expand Down

0 comments on commit b4de8aa

Please sign in to comment.