summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/process_log.sh26
-rw-r--r--src/cadet/gnunet-service-cadet.c2
2 files changed, 20 insertions, 8 deletions
diff --git a/contrib/process_log.sh b/contrib/process_log.sh
index 18b921a29..baade73d9 100755
--- a/contrib/process_log.sh
+++ b/contrib/process_log.sh
@@ -1,18 +1,30 @@
-#!/bin/sh
+#!/bin/bash
+
+# Usage: service should print "STARTING SERVICE (srvc) for peer [PEER]" where:
+# - "srvc" is the service name (in lowercase, as in the log output).
+# It cannot contain parenthesis in its name.
+# - "PEER" is the peer ID. Should be 4 alfanumeric characters
+
grep "STARTING SERVICE " log > __tmp_peers
+
SED_EXPR=""
while read -r line; do
+ SRVC=`echo $line | sed -e 's/.*(\([^)]*\)).*/\1/'`
PEER=`echo $line | sed -e 's/.*\[\(....\)\].*/\1/'`
- PID=`echo $line | sed -e 's/.*cadet-\([0-9]*\).*/\1/'`
- echo "$PID => $PEER"
- SED_EXPR="${SED_EXPR}s/cadet-\([a-z2]*\)-$PID/CADET \1 $PEER/;"
- SED_EXPR="${SED_EXPR}s/cadet-$PID/CADET XXX $PEER/;"
+ PID=`echo $line | sed -e "s/.*$SRVC-\([0-9]*\).*/\1/"`
+ echo "$SRVC $PID => $PEER"
+
+ SED_EXPR="${SED_EXPR}s/$SRVC-\([a-z2]*\)-$PID/$SRVC \1 $PEER/;"
+ SED_EXPR="${SED_EXPR}s/$SRVC-$PID/$SRVC XXX $PEER/;"
+ SED_EXPR="${SED_EXPR}s/$SRVC-api-[0-9]/$SRVC-api- /;"
done < __tmp_peers
rm __tmp_peers
-SED_EXPR="${SED_EXPR}s/cadet-api-/cadet-api- /g"
sed -e "$SED_EXPR" log > .log
+echo "$0 sed regex: $SED_EXPR" >> .log
+
+SIZE=`stat -c%s .log`
-if [[ "`ps aux | grep "kwrite .lo[g]"`" = "" ]]; then
+if [[ "`ps aux | grep "kwrite .lo[g]"`" = "" && "$SIZE" < 10000000 ]]; then
kwrite .log --geometry 960x1140-960 &
fi
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c
index 3f868145e..0cbd384ae 100644
--- a/src/cadet/gnunet-service-cadet.c
+++ b/src/cadet/gnunet-service-cadet.c
@@ -144,7 +144,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_full_id.public_key);
myid = GNUNET_PEER_intern (&my_full_id);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "STARTING SERVICE (CADET) for peer [%s]\n",
+ "STARTING SERVICE (cadet) for peer [%s]\n",
GNUNET_i2s (&my_full_id));
GML_init (server); /* Local clients */