[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r37219 - in gnunet: contrib src/arm
From: |
gnunet |
Subject: |
[GNUnet-SVN] r37219 - in gnunet: contrib src/arm |
Date: |
Tue, 31 May 2016 17:13:24 +0200 |
Author: lynx
Date: 2016-05-31 17:13:24 +0200 (Tue, 31 May 2016)
New Revision: 37219
Modified:
gnunet/contrib/gnunet-logread
gnunet/src/arm/gnunet-arm.c
Log:
added filters to gnunet-logread and an automation fix for gnunet-arm
Modified: gnunet/contrib/gnunet-logread
===================================================================
--- gnunet/contrib/gnunet-logread 2016-05-31 15:13:15 UTC (rev 37218)
+++ gnunet/contrib/gnunet-logread 2016-05-31 15:13:24 UTC (rev 37219)
@@ -1,27 +1,36 @@
#!/usr/bin/env perl
+# helper tool to make gnunet logs more readable
+# try 'gnunet-logread -h' for usage
-# Usage:
-# gnunet-service |& gnunet-logread
-# gnunet-logread service.log
-#
-# Options:
-# -n <component_name> Name of this component to use for IPC
logging.
-# -i </path/to/ipc.sock> Path to IPC logging socket.
-# Passing on log messages to IPC socket:
-# -L <LOGLEVEL> Minimum level of messages to pass on.
-# Log levels: NONE, ERROR, WARNING, INFO, DEBUG.
-# -m <regex> Only pass on messages matching a regular
expression.
-
use strict;
use warnings;
use Getopt::Std;
+my (%opts, $name, $ipc, $msg_level, $msg_regex);
+getopts ('i:x:n:s:L:m:h', \%opts);
+
+die <<X if $opts{h};
+Usage:
+ <gnunet-service> |& $0 [<options>]
+ or
+ $0 [<options>] <service.log>
+
+Options:
+ Regular screen output options:
+ -i <regex> Include only messages that match regex.
+ -x <regex> Exclude all messages that match regex.
+
+ Options to enable message passing to IPC socket:
+ -n <component_name> Name of this component to use for IPC
logging.
+ -s </path/to/ipc.sock> Path to IPC logging socket.
+ -L <LOGLEVEL> Minimum level of messages to pass on.
+ Log levels: NONE, ERROR, WARNING, INFO, DEBUG.
+ -m <regex> Only pass messages matching a regular
expression.
+X
+
use Term::ANSIColor qw(:constants :pushpop);
$Term::ANSIColor::AUTOLOCAL = 1;
-my (%opts, $name, $ipc, $msg_level, $msg_regex);
-getopts ('n:i:L:m:', \%opts);
-
# Message type numbers to names
my %msgtypes;
my $prefix = $ENV{GNUNET_PREFIX} || '/usr';
@@ -34,17 +43,21 @@
$msgtypes{$2} = $1 if
/^\s*#define\s+GNUNET_MESSAGE_TYPE_(\w+)\s+(\d+)/i;
}
close HEADER;
+} else {
+ warn <<X;
+Could not read $filename for message codes:
+ $!.
+Please provide a \$GNUNET_PREFIX environment variable to replace "/usr".
+Try also '$0 -h' for help
+
+X
}
-else
-{
- warn "$filename: $!, try setting \$GNUNET_PREFIX";
-}
my %levels = ( NONE => 0, ERROR => 1, WARNING => 2, INFO => 4, DEBUG => 8 );
if (exists $opts{n})
{
$name = $opts{n};
- $ipc = $opts{i} || '/tmp/gnunet-logread-ipc.sock';
+ $ipc = $opts{s} || '/tmp/gnunet-logread-ipc.sock';
$msg_level = exists $levels{$opts{L}} ? $levels{$opts{L}} : 0;
$msg_regex = $opts{m};
print STDERR "RE: /$msg_regex/\n" if defined $msg_regex;
@@ -83,6 +96,8 @@
print IPC "$time\t$name\t$level: $msg\n";
}
}
+ next if $opts{x} and /$opts{x}/io;
+ next if $opts{i} and not /$opts{i}/io;
# Timestamp (e.g. Nov 01 19:36:11-384136)
s/^([A-Z][a-z]{2} .[0-9] [0-9:]{8}(?:-[0-9]{6})?)/YELLOW $1/e;
Modified: gnunet/src/arm/gnunet-arm.c
===================================================================
--- gnunet/src/arm/gnunet-arm.c 2016-05-31 15:13:15 UTC (rev 37218)
+++ gnunet/src/arm/gnunet-arm.c 2016-05-31 15:13:24 UTC (rev 37219)
@@ -544,7 +544,8 @@
ret = 3;
return;
}
- FPRINTF (stdout, "%s", _("Running services:\n"));
+ if (! quiet)
+ FPRINTF (stdout, "%s", _("Running services:\n"));
for (i = 0; i < count; i++)
FPRINTF (stdout, "%s\n", list[i]);
al_task = GNUNET_SCHEDULER_add_now (&action_loop, NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r37219 - in gnunet: contrib src/arm,
gnunet <=