Skip to content

Commit

Permalink
add missing files
Browse files Browse the repository at this point in the history
  • Loading branch information
robbederks committed Jan 27, 2022
1 parent 0bacaab commit ddb31ce
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions release/files_common
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ selfdrive/common/version.h

selfdrive/common/swaglog.h
selfdrive/common/swaglog.cc
selfdrive/common/statlog.h
selfdrive/common/statlog.cc
selfdrive/common/util.cc
selfdrive/common/util.h
selfdrive/common/queue.h
Expand Down
3 changes: 2 additions & 1 deletion selfdrive/common/swaglog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

class SwaglogState : public LogState {
public:
inline SwaglogState() : LogState("ipc:///tmp/logmessage") {
SwaglogState() : LogState("ipc:///tmp/logmessage") {
ctx_j = json11::Json::object {};
print_level = CLOUDLOG_WARNING;
const char* print_lvl = getenv("LOGPRINT");
if (print_lvl) {
Expand Down
15 changes: 8 additions & 7 deletions selfdrive/common/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,23 @@ void update_max_atomic(std::atomic<T>& max, T const& value) {

class LogState {
public:
inline LogState(const char* socket) {
std::mutex lock;
void *zctx;
void *sock;
int print_level;

LogState(const char* endpoint) {
zctx = zmq_ctx_new();
sock = zmq_socket(zctx, ZMQ_PUSH);

// Timeout on shutdown for messages to be received by the logging process
int timeout = 100;
zmq_setsockopt(sock, ZMQ_LINGER, &timeout, sizeof(timeout));

zmq_connect(sock, socket);
zmq_connect(sock, endpoint);
};
inline ~LogState() {
~LogState() {
zmq_close(sock);
zmq_ctx_destroy(zctx);
}
std::mutex lock;
void *zctx;
void *sock;
int print_level;
};

0 comments on commit ddb31ce

Please sign in to comment.