[Mageia-dev] [soft-commits] [6435] Added a first log viewer module.

Colin Guthrie mageia at colin.guthr.ie
Mon Nov 12 12:40:27 CET 2012


'Twas brillig, and Guillaume Rousse at 12/11/12 08:44 did gyre and gimble:
> Le 11/11/2012 19:13, root at mageia.org a écrit :
>> +package LogViewer;
>> +
>> +use strict;
>> +use POSIX;
> never load the POSIX module this way. Either import it without importing
> any symbol in your namespace, either import just the symbols you need.
> See POSIX(3pm) for details.
> 
> [..]
>> +    $::isWizard = 1;
> ugly syntax.
> 
> [..]
>> +#- check services
>> +my ) . Data::Dumper->Dump([ $service ], [qw(*services)]) . q(
>> +foreach (split(':', $options{SERVICES})) {
>> +    next unless $services{$_};
>> +    $r .= "Service $_ ($services{$_} is not running)\\n" unless -e
>> "/var/lock/subsys/$_";
>> +}
> You shouldn't leave debugging statement in your code. Moreover, I doubt
> this is syntactically correct. Do you use Test::Compile to check your
> code compiles correctly ?

Also /var/log/subsys is almost dead under systemd anyway. It's still
used by a few legacy initscripts that systemd calls, but I'm not sure
where this is going.

Also, if you are implementing a new log viewer module, is this going to
use the systemd journal rather than implementing it's own complex logic
for parsing compressed text files? I've not looked at the code, but it
would be *awesome* if this is what was happening :)

It's very easy to use the journal APIs (either by linking the library,
using python bindings - not sure if there are external perl bindings
yet, but I wouldn't be surprised if there are - or simply calling
journalctl on the command line and parsing the result. It offers an easy
to parse JSON format so even going via this route should be trivial if
official bindings do not exist). You can get all logs between certain
dates and for particular services with ease, without having to look in
the right file or grep for the right binary. i.e. all the building
blocks are in place for you :)

Col


-- 

Colin Guthrie
colin(at)mageia.org
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the Mageia-dev mailing list