aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorCarlo von lynX <lynX@time.to.get.psyced.org>2016-07-28 13:05:33 +0000
committerCarlo von lynX <lynX@time.to.get.psyced.org>2016-07-28 13:05:33 +0000
commitbc5798bad9474460df4943701933c9444f6a2305 (patch)
treefb14d75ba3c21cc9a45a1500d138b99266af10fc /contrib
parent9517e45e19a2552554b2a4e2c6faf48d04c78ffb (diff)
downloadgnunet-bc5798bad9474460df4943701933c9444f6a2305.tar.gz
gnunet-bc5798bad9474460df4943701933c9444f6a2305.zip
gnunet-logread with intelligent usage message and proper perldoc
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/gnunet-logread89
1 files changed, 68 insertions, 21 deletions
diff --git a/contrib/gnunet-logread b/contrib/gnunet-logread
index 2e54d133f..f58758cb9 100755
--- a/contrib/gnunet-logread
+++ b/contrib/gnunet-logread
@@ -6,30 +6,19 @@ use strict;
6use warnings; 6use warnings;
7my $DEFAULT_SOCKET = '/tmp/gnunet-logread-ipc.sock'; 7my $DEFAULT_SOCKET = '/tmp/gnunet-logread-ipc.sock';
8 8
9use Getopt::Std; 9print STDERR <<X if -t STDIN and $#ARGV == -1;
10my (%opts, $name, $ipc, $msg_level, $msg_regex); 10*** For a usage message, try '$0 -h'.
11getopts ('i:x:n:s:L:m:fh', \%opts); 11*** For documentation, try 'perldoc $0'.
12 12*** Listening for GNUNET_log events on STDIN. Type CTRL-D to terminate.
13die <<X if $opts{h};
14Usage:
15 <gnunet-service> |& $0 [<options>]
16 or
17 $0 [<options>] [<logfile>]
18 13
19Options: 14X
20 -f Follow input from IPC FIFO socket.
21 15
22 Regular screen output options: 16use Getopt::Std;
23 -i <regex> Include only messages that match <regex>. 17my (%opts, $name, $ipc, $msg_level, $msg_regex);
24 -x <regex> Exclude all messages that match <regex>. 18getopts ('i:x:n:s:L:m:fhq', \%opts);
25 19
26 Options to enable message passing to IPC socket: 20use Pod::Usage qw( pod2usage );
27 -n <component_name> Name of this component to use for IPC logging. 21die pod2usage if $opts{h};
28 -s </path/to/ipc.sock> Default = $DEFAULT_SOCKET
29 -L <LOGLEVEL> Minimum level of messages to pass on.
30 Log levels: NONE, ERROR, WARNING, INFO, DEBUG.
31 -m <regex> Only pass messages matching a regular expression.
32X
33 22
34use POSIX qw(mkfifo); 23use POSIX qw(mkfifo);
35 24
@@ -150,3 +139,61 @@ sub perform {
150 print; 139 print;
151} 140}
152 141
142__END__
143
144=pod
145
146=head1 NAME
147
148gnunet-logread - a GNUnet log analyzer, colorizer and aggregator
149
150=head1 SYNOPSIS
151
152 <gnunet-service> |& $0 [<options>]
153 or
154 $0 [<options>] [<logfile>]
155
156 Options:
157 -f Follow input from IPC FIFO socket.
158
159 Regular screen output options:
160 -i <regex> Include only messages that match <regex>.
161 -x <regex> Exclude all messages that match <regex>.
162 -q Quiet: Do not show usage advice to new users.
163
164 Options to forward messages to the IPC FIFO socket:
165 -n <component_name> Name of the component we are forwarding messages for.
166 -s </path/to/ipc.sock> Default = $DEFAULT_SOCKET
167 -L <LOGLEVEL> Minimum level of messages to forward:
168 Log levels: NONE, ERROR, WARNING, INFO, DEBUG.
169 -m <regex> Only forward messages matching a regular expression.
170
171 See 'perldoc gnunet-logread' for a longer explanation.
172
173=head1 MOTIVATION
174
175GNUnet debug logs are a tedious read, but given a complex system that we
176cannot run all parts of in a debugger all the time, some gathering and
177structuring of events and message passing is useful.
178
179At first, this tool simply makes logs easier to read. Both if viewed in
180real-time or taken from disk. Then it also allows to extract all message
181passing events from it and forward them to a special process that aggregates
182all message passing events and therefore helps you make sense of all the
183inter-process communication (IPC) happening between the various pieces of
184the GNUnet system beast.
185
186That master process is simply an extra gnunet-logread that you run in a
187separate window and adorn it with the '-f' flag. The submitting processes
188instead need to be given a '-n' flag. That is because from the GNUnet logs
189it isn't clear which process events belong too. For example you may be
190having events taking place in the 'util' subsystem of gnunet-psyc-service
191just as much as in the 'util' subsystem of gnunet-multicast-service. In
192order to make sense of them it is necessary to manually add that info. This
193could be remedied by extending the semantics of the GNUNET_log facility
194instead, but that is still subject to further consideration.
195
196=head1 AUTHORS
197
198tg & lynX
199