 |
Cadabra
Computer algebra system for field theory problems
|
Go to the documentation of this file.
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=
"");
C++ representation of a log entry.
Definition: Snoop.hh:124
websocketpp::config::asio_client::message_type::ptr message_ptr
Definition: ComputeThread.hh:13
void on_client_message(websocketpp::connection_hdl hdl, message_ptr msg)
Definition: Snoop.cc:746
WebsocketClient wsclient
Websocket client to talk to a remote logging server.
Definition: SnoopPrivate.hh:113
SnoopImpl(Snoop *)
Definition: Snoop.cc:68
bool store_log_entry(Snoop::LogEntry &, bool avoid_server_duplicates)
Store a log entry in the local database.
Definition: Snoop.cc:378
std::mutex connection_mutex
Definition: SnoopPrivate.hh:115
Snoop & operator<<(const Flush &)
Definition: Snoop.cc:876
void on_client_fail(websocketpp::connection_hdl hdl)
Definition: Snoop.cc:725
~SnoopImpl()
Definition: Snoop.cc:817
C++ representation of a run entry.
Definition: Snoop.hh:96
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:486
std::mutex call_mutex
Definition: SnoopPrivate.hh:127
void create_tables()
Ensure that the required tables are present in the database file.
Definition: Snoop.cc:227
Logging class with functionality to send log information to a remote server using a websocket connect...
Definition: Snoop.hh:36
bool store_app_entry(Snoop::AppEntry &)
Store an app entry in the database.
Definition: Snoop.cc:322
void sync_runs_with_server(bool from_wsthread=false)
As above, but only for run entries.
Definition: Snoop.cc:503
sqlite3_stmt * insert_statement
Prepared statements (only need to prepare these once).
Definition: SnoopPrivate.hh:108
sqlite3 * db
Definition: SnoopPrivate.hh:60
void sync_logs_with_server(bool from_wsthread=false)
As above, but only for log entries.
Definition: Snoop.cc:585
std::thread wsclient_thread
Definition: SnoopPrivate.hh:114
std::string server_
Definition: SnoopPrivate.hh:64
void obtain_uuid()
Obtain a uuid by finding the last AppEntry stored in the local database.
Definition: Snoop.cc:288
std::condition_variable connection_cv
Definition: SnoopPrivate.hh:116
bool store_app_entry_without_lock(Snoop::AppEntry &)
Definition: Snoop.cc:331
websocketpp::client< websocketpp::config::asio_client > WebsocketClient
Definition: SnoopPrivate.hh:12
websocketpp::connection_hdl our_connection_hdl
Definition: SnoopPrivate.hh:119
WebsocketClient::connection_ptr connection
Definition: SnoopPrivate.hh:118
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:81
Snoop::LogEntry this_log_
Definition: SnoopPrivate.hh:63
void on_client_open(websocketpp::connection_hdl hdl)
Definition: Snoop.cc:714
Snoop::AppEntry this_app_
Definition: SnoopPrivate.hh:62
Snoop * snoop_
Definition: SnoopPrivate.hh:58
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:857
Definition: SnoopPrivate.hh:17
bool connection_attempt_failed
Definition: SnoopPrivate.hh:117
void start_websocket_client()
Start the websocket client.
Definition: Snoop.cc:445
std::mutex sqlite_mutex
Definition: SnoopPrivate.hh:109
server
Definition: cadabra2_defaults.py:153
void on_client_close(websocketpp::connection_hdl hdl)
Definition: Snoop.cc:735
std::string get_user_uuid(const std::string &app_name)
Get a string which uniquely identifies the current user.
Definition: Snoop.cc:173
bool connection_is_open
Definition: SnoopPrivate.hh:117
websocketpp::config::asio_client::message_type::ptr message_ptr
Definition: SnoopPrivate.hh:13
sqlite3_stmt * id_for_uuid_statement
Definition: SnoopPrivate.hh:108
std::vector< Snoop::AppEntry > get_app_registrations(std::string uuid_filter="")
Return a vector of all aps registered in the database.
Definition: Snoop.cc:662