4 #include <websocketpp/config/asio_no_tls_client.hpp>
5 #include <websocketpp/client.hpp>
6 #include <websocketpp/common/thread.hpp>
7 #include <websocketpp/common/functional.hpp>
9 #include <condition_variable>
13 typedef websocketpp::config::asio_client::message_type::ptr
message_ptr;
28 void init(
const std::string& app_name,
const std::string& app_version,
29 std::string server=
"", std::string local_log_file=
"");
41 Snoop&
operator()(
const std::string& type, std::string fl=
"",
int loc=-1, std::string method=
"");
std::mutex call_mutex
Definition: SnoopPrivate.hh:127
std::mutex connection_mutex
Definition: SnoopPrivate.hh:115
Snoop::AppEntry this_app_
Definition: SnoopPrivate.hh:62
void start_websocket_client()
Start the websocket client.
Definition: Snoop.cc:439
bool store_app_entry(Snoop::AppEntry &)
Store an app entry in the database.
Definition: Snoop.cc:316
sqlite3_stmt * insert_statement
Prepared statements (only need to prepare these once).
Definition: SnoopPrivate.hh:108
websocketpp::config::asio_client::message_type::ptr message_ptr
Definition: ComputeThread.hh:12
C++ representation of an run entry.
Definition: Snoop.hh:91
bool store_log_entry(Snoop::LogEntry &, bool avoid_server_duplicates)
Store a log entry in the local database.
Definition: Snoop.cc:372
~SnoopImpl()
Definition: Snoop.cc:810
std::thread wsclient_thread
Definition: SnoopPrivate.hh:114
std::vector< Snoop::AppEntry > get_app_registrations(std::string uuid_filter="")
Return a vector of all aps registered in the database.
Definition: Snoop.cc:655
Definition: SnoopPrivate.hh:17
std::mutex sqlite_mutex
Definition: SnoopPrivate.hh:109
void create_tables()
Ensure that the required tables are present in the database file.
Definition: Snoop.cc:221
Snoop::LogEntry this_log_
Definition: SnoopPrivate.hh:63
bool connection_attempt_failed
Definition: SnoopPrivate.hh:117
Logging class with functionality to send log information to a remote server using a websocket connect...
Definition: Snoop.hh:32
SnoopImpl(Snoop *)
Definition: Snoop.cc:62
WebsocketClient wsclient
Websocket client to talk to a remote logging server.
Definition: SnoopPrivate.hh:113
void sync_with_server(bool from_wsthread=false)
Ensure that the local database is synchronised with the server (this sends multiple app or log entrie...
Definition: Snoop.cc:479
Snoop * snoop_
Definition: SnoopPrivate.hh:58
bool store_app_entry_without_lock(Snoop::AppEntry &)
Definition: Snoop.cc:325
bool connection_is_open
Definition: SnoopPrivate.hh:117
void sync_runs_with_server(bool from_wsthread=false)
As above, but only for run entries.
Definition: Snoop.cc:496
WebsocketClient::connection_ptr connection
Definition: SnoopPrivate.hh:118
Snoop & operator()(const std::string &type, std::string fl="", int loc=-1, std::string method="")
Operator to initialise a logging entry with the type of the log message as well as (optionally) the f...
Definition: Snoop.cc:850
std::string server_
Definition: SnoopPrivate.hh:64
std::condition_variable connection_cv
Definition: SnoopPrivate.hh:116
void on_client_close(websocketpp::connection_hdl hdl)
Definition: Snoop.cc:728
void on_client_message(websocketpp::connection_hdl hdl, message_ptr msg)
Definition: Snoop.cc:739
void obtain_uuid()
Obtain a uuid by finding the last AppEntry stored in the local database.
Definition: Snoop.cc:282
std::string get_user_uuid(const std::string &app_name)
Get a string which uniquely identifies the current user.
Definition: Snoop.cc:167
void on_client_fail(websocketpp::connection_hdl hdl)
Definition: Snoop.cc:718
websocketpp::client< websocketpp::config::asio_client > WebsocketClient
Definition: SnoopPrivate.hh:12
void sync_logs_with_server(bool from_wsthread=false)
As above, but only for log entries.
Definition: Snoop.cc:578
void init(const std::string &app_name, const std::string &app_version, std::string server="", std::string local_log_file="")
Initialise the logging stream.
Definition: Snoop.cc:75
void on_client_open(websocketpp::connection_hdl hdl)
Definition: Snoop.cc:707
C++ representation of a log entry.
Definition: Snoop.hh:119
sqlite3_stmt * id_for_uuid_statement
Definition: SnoopPrivate.hh:108
websocketpp::config::asio_client::message_type::ptr message_ptr
Definition: SnoopPrivate.hh:13
Snoop & operator<<(const Flush &)
Definition: Snoop.cc:869
sqlite3 * db
Definition: SnoopPrivate.hh:60
websocketpp::connection_hdl our_connection_hdl
Definition: SnoopPrivate.hh:119