From f9a74a9f964ba27e5e7e750077c16a335112339e Mon Sep 17 00:00:00 2001
From: Dinyar Rabady <dinyar.rabady@cern.ch>
Date: Sat, 24 Sep 2022 17:47:45 +0200
Subject: [PATCH] Format log messages for journald consumption

Additionally remove logger at output, this doesn't appear to be
necessary.

Belongs to #19.
---
 scripts/run.sh |  2 +-
 src/Makefile   |  2 +-
 src/log.h      | 18 ++++++++++++------
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/scripts/run.sh b/scripts/run.sh
index 7a2675d6..ef52faf6 100755
--- a/scripts/run.sh
+++ b/scripts/run.sh
@@ -14,7 +14,7 @@ umask 000 # Files and folders we create should be world accessible
 while true 
 do
     echo "Starting scdaq..."
-    /opt/scdaq/bin/scdaq --config /etc/scdaq/scdaq.conf 2>&1 | logger --tag scdaq --id -p user.debug
+    /opt/scdaq/bin/scdaq --config /etc/scdaq/scdaq.conf 2>&1
     echo "Resetting the board..."
     ../scripts/reset-firmware.sh
     echo "Clearing caches..."
diff --git a/src/Makefile b/src/Makefile
index 20d0396a..f4e68d68 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -27,7 +27,7 @@ CXXFLAGS = -std=c++11 -Wall -Wextra -O0 -g -rdynamic -Wconversion
 #CXXFLAGS = -std=c++11 -Wall -Wextra -g -rdynamic
 
 CFLAGS = $(CXXFLAGS)
-LDFLAGS = -Llibmicron -ltbb -ltbbmalloc -lboost_thread -lboost_chrono -lcurl -lpthread -lcrypto 
+LDFLAGS = -Llibmicron -ltbb -ltbbmalloc -lboost_thread -lboost_chrono -lcurl -lpthread -lcrypto
 
 CPPFLAGS = -I. -Iwzdma
 
diff --git a/src/log.h b/src/log.h
index d8ffe15f..ec7757d0 100644
--- a/src/log.h
+++ b/src/log.h
@@ -84,12 +84,18 @@ inline std::ostream& operator<< (std::ostream& os, enum LOG_LEVEL severity)
 {
     switch (severity)
     {
-        case TRACE:     return os << "TRACE   " ;
-        case DEBUG:     return os << "DEBUG   ";
-        case INFO:      return os << "INFO    ";
-        case WARNING:   return os << "WARNING ";
-        case ERROR:     return os << "ERROR   ";
-        case FATAL:     return os << "FATAL   ";
+        case TRACE:
+            return os << "<7> " ;
+        case DEBUG:
+            return os << "<7> ";
+        case INFO:
+            return os << "<6> ";
+        case WARNING:
+            return os << "<4> ";
+        case ERROR:
+            return os << "<3> ";
+        case FATAL:
+            return os << "<1> ";
     };
     return os;
 }
-- 
GitLab