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:444
bool store_app_entry(Snoop::AppEntry &)
Store an app entry in the database.
Definition: Snoop.cc:321
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:13
C++ representation of a run entry.
Definition: Snoop.hh:95
bool store_log_entry(Snoop::LogEntry &, bool avoid_server_duplicates)
Store a log entry in the local database.
Definition: Snoop.cc:377
~SnoopImpl()
Definition: Snoop.cc:815
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:660
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:226
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:36
SnoopImpl(Snoop *)
Definition: Snoop.cc:67
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:484
Snoop * snoop_
Definition: SnoopPrivate.hh:58
bool store_app_entry_without_lock(Snoop::AppEntry &)
Definition: Snoop.cc:330
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:501
server
Definition: cadabra2_defaults.py:134
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:855
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:733
void on_client_message(websocketpp::connection_hdl hdl, message_ptr msg)
Definition: Snoop.cc:744
void obtain_uuid()
Obtain a uuid by finding the last AppEntry stored in the local database.
Definition: Snoop.cc:287
std::string get_user_uuid(const std::string &app_name)
Get a string which uniquely identifies the current user.
Definition: Snoop.cc:172
void on_client_fail(websocketpp::connection_hdl hdl)
Definition: Snoop.cc:723
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:583
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:80
void on_client_open(websocketpp::connection_hdl hdl)
Definition: Snoop.cc:712
C++ representation of a log entry.
Definition: Snoop.hh:123
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:874
sqlite3 * db
Definition: SnoopPrivate.hh:60
websocketpp::connection_hdl our_connection_hdl
Definition: SnoopPrivate.hh:119