20 #include <json/json.h>
41 void init(
const std::string& app_name,
const std::string& app_version,
42 std::string server=
"", std::string local_log_file=
"");
55 Snoop&
operator()(
const std::string& type, std::string fl=
"",
int loc=-1, std::string method=
"");
94 AppEntry(
const std::string& uuid_, uint64_t create_millis_, uint64_t receive_millis_, pid_t pid_,
95 const std::string& ip_address_,
const std::string& machine_id_,
96 const std::string& app_name_,
const std::string& app_version_,
97 const std::string& user_id_,
100 std::string
to_json(
bool human_readable)
const;
122 LogEntry(
int log_id_,
int client_log_id_,
int id_,
const std::string&,
123 uint64_t, uint64_t,
const std::string&,
int,
const std::string&,
124 const std::string& ,
const std::string&,
int status);
126 std::string
to_json(
bool human_readable)
const;
164 #define LOC __FILE__, __LINE__, __func__
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:845
SnoopImpl * impl
Definition: Snoop.hh:147
std::ostringstream out_
Definition: Snoop.hh:144
std::string get_user_uuid(const std::string &app_name)
Get a string which uniquely identifies the current user.
Definition: Snoop.cc:162
std::string to_json(bool human_readable) const
Definition: Snoop.cc:912
int log_id
Definition: Snoop.hh:129
const char fatal[]
Definition: Snoop.hh:157
uint64_t receive_millis
Definition: Snoop.hh:106
C++ representation of an run entry.
Definition: Snoop.hh:91
Snoop & operator<<(const T &obj)
Generic operator to log an object to the log message being constructed.
Definition: Snoop.hh:60
std::string app_version
Definition: Snoop.hh:111
bool connected
Definition: Snoop.hh:114
int server_status
Definition: Snoop.hh:113
Definition: SnoopPrivate.hh:17
void from_json(const Json::Value &)
Definition: Snoop.cc:1000
const char email[]
Definition: Snoop.hh:158
uint64_t create_millis
Definition: Snoop.hh:133
uint64_t create_millis
Definition: Snoop.hh:105
int client_log_id
Definition: Snoop.hh:130
Logging class with functionality to send log information to a remote server using a websocket connect...
Definition: Snoop.hh:32
int id
Definition: Snoop.hh:131
std::string machine_id
Definition: Snoop.hh:109
std::string uuid
Definition: Snoop.hh:132
void set_sync_immediately(bool)
Set to sync with server after every log line.
Definition: Snoop.cc:216
int id
Definition: Snoop.hh:103
std::string user_id
Definition: Snoop.hh:112
const char error[]
Definition: Snoop.hh:156
std::string message
Definition: Snoop.hh:139
Snoop log
Definition: Snoop.cc:43
void from_json(const Json::Value &)
Definition: Snoop.cc:1015
Snoop()
Definition: Snoop.cc:57
void sync_logs_with_server(bool from_wsthread=false)
As above, but only for log entries.
Definition: Snoop.cc:573
bool sync_immediately_
Definition: Snoop.hh:145
int server_status
Definition: Snoop.hh:140
Flush flush
Definition: Snoop.cc:44
~Snoop()
Definition: Snoop.cc:805
const char warn[]
Definition: Snoop.hh:155
void sync_runs_with_server(bool from_wsthread=false)
As above, but only for run entries.
Definition: Snoop.cc:491
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:474
std::string loc_file
Definition: Snoop.hh:135
std::string type
Definition: Snoop.hh:138
const char info[]
Definition: Snoop.hh:154
std::string uuid
Definition: Snoop.hh:104
AppEntry()
Definition: Snoop.cc:950
LogEntry()
Definition: Snoop.cc:898
friend SnoopImpl
Definition: Snoop.hh:148
std::string to_json(bool human_readable) const
Definition: Snoop.cc:966
std::string ip_address
Definition: Snoop.hh:108
uint64_t receive_millis
Definition: Snoop.hh:134
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:67
C++ representation of a log entry.
Definition: Snoop.hh:119
pid_t pid
Definition: Snoop.hh:107
std::string loc_method
Definition: Snoop.hh:137
std::string app_name
Definition: Snoop.hh:110
int loc_line
Definition: Snoop.hh:136