diff options
author | Yves Duret <yduret@mandriva.com> | 2001-08-01 17:30:21 +0000 |
---|---|---|
committer | Yves Duret <yduret@mandriva.com> | 2001-08-01 17:30:21 +0000 |
commit | 91d3b9c3794ce64e58ab0ee08b3ee8c39446720e (patch) | |
tree | 0f4c271eb5bc0f514c1a1ec7e1df8f3c650da92c /logdrake | |
parent | 98e0bde070ff7c13bc7850bf05687cf38011c4d4 (diff) | |
download | control-center-91d3b9c3794ce64e58ab0ee08b3ee8c39446720e.tar control-center-91d3b9c3794ce64e58ab0ee08b3ee8c39446720e.tar.gz control-center-91d3b9c3794ce64e58ab0ee08b3ee8c39446720e.tar.bz2 control-center-91d3b9c3794ce64e58ab0ee08b3ee8c39446720e.tar.xz control-center-91d3b9c3794ce64e58ab0ee08b3ee8c39446720e.zip |
added mapping..
Diffstat (limited to 'logdrake')
-rwxr-xr-x | logdrake | 99 |
1 files changed, 79 insertions, 20 deletions
@@ -135,6 +135,13 @@ my $col=$cyan; ######### font and colors end +my %files = ( + "auth" => { file => "/var/log/auth.log", desc => _("authentification") }, + "user" => { file => "/var/log/user.log", desc => _("user") }, + "auth" => { file => "/var/log/auth.log", desc => _("authentification") }, + "syslog" => { file => "/var/log/syslog", desc => _("syslog") } +); + # Create root tree my $tree = new Gtk::Tree(); my $leaf; @@ -142,6 +149,26 @@ my $root_dir; $tree->set_selection_mode('single'); $tree->set_view_mode('item'); fill_tree (""); +# 1, gtkadd(new Gtk::Frame(_("Choose a file")), +# gtkpack_(new Gtk::VBox(0,5), +# 1, createScrolledWindow($tree), +# 0, gtkpack(new Gtk::HBox(0,5), +# gtksignal_connect(new Gtk::Button("syslog"), clicked => \&select_item, "/var/log/syslog"), +# gtksignal_connect(new Gtk::Button("dmesg"), clicked => \&select_item, "/var/log/dmesg"), +# gtksignal_connect(new Gtk::Button("user.log"), clicked => \&select_item, "/var/log/user.log") +# ) +# ) +# ), + + + +#{ +# no strict 'refs'; +# map { ${$_ . "1"} = $i++ } qw(a b c); +# +# print join(" ", map { ${$_ . "1"} = $i++ } qw(a b c)), "\n"; +#} +#print join(" ", map { ${$foo::{$_ . "1"}} } qw(a b c)), "\n"; #### far from window @@ -149,23 +176,20 @@ gtkadd($window, gtkpack_(new Gtk::VBox(0,5), 0, _("see your log"), 1, gtkadd(new Gtk::Frame(_("toi aussi choisi")), - $in->ask_many_from_list("drakxservices", - _("Choose which services should be automatically started at boot time"), - { - list => [ "l2", "l1" ,"l3"], - help => sub { $_; }, - values => [ "v2", "v1" ,"v3"], - sort => 1, - }) - ), - 1, gtkadd(new Gtk::Frame(_("Choose a file")), gtkpack_(new Gtk::VBox(0,5), - 1, createScrolledWindow($tree), - 0, gtkpack(new Gtk::HBox(0,5), - gtksignal_connect(new Gtk::Button("syslog"), clicked => \&select_item, "/var/log/syslog"), - gtksignal_connect(new Gtk::Button("dmesg"), clicked => \&select_item, "/var/log/dmesg"), - gtksignal_connect(new Gtk::Button("user.log"), clicked => \&select_item, "/var/log/user.log") - ) + 0, gtkpack_(new Gtk::HBox(0,5), + 0, _("matching"), + 1, $e_yes = new Gtk::Entry(), + 0, _("not matching"), + 1, $e_no = new Gtk::Entry() + ), + 0, _("tips: you can use OR"), + 0, gtkpack (new Gtk::VBox(0,5), + map { + ${"b_". $_} = new Gtk::CheckButton($files{$_}{desc}) + } keys %files, + ), + 0, gtksignal_connect(new Gtk::Button(_("search")), clicked => \&search) ) ), 1, gtkadd(new Gtk::Frame(_("Content of the file")), @@ -182,6 +206,20 @@ Gtk->main_iteration while Gtk->events_pending; $::isEmbedded and kill USR2, $::CCPID; Gtk->main; +#------------------------------------------------------------- +# search functions +#------------------------------------------------------------- +sub search { + + $log->backward_delete($log->get_length()); + $log->freeze(); + + map { parse_file($files{$_}{file}) if ${$::{"b_". $_}}->active } keys %files; +# map { print "($files{$_}{file})\n" if ${$::{"b_". $_}}->active } keys %files; + + $log->thaw(); + +} #------------------------------------------------------------- # tree functions @@ -255,8 +293,15 @@ sub select_item { return if (-d $file); $log->backward_delete($log->get_length()); - $file =~ s/\.gz$//; $log->freeze(); + parse_file($file); + $log->thaw(); +} + +sub parse_file { + print "$_\n"; +return; + $file =~ s/\.gz$//; my @all=catMaybeCompressed ($file); my $taille= @all +1; my $i=1; @@ -268,17 +313,28 @@ sub select_item { ); $win_pb->realize(); $win_pb->show_all(); + my $ey= $e_yes->get_chars( 0, -1 ); + my $en= $e_no->get_chars( 0, -1 ); + $ey =~ s/ OR /\|/; foreach (@all) { if ($i % 10) { $pbar->update($i/$taille); Gtk->main_iteration while Gtk->events_pending; } - logcolorize($_); + + if (($en eq "") and ($ey eq "")) { + logcolorize($_) + } else { + if (/$ey/i and ($en eq "")) { + logcolorize($_); + } else { + # eq =! "" + logcolorize($_) if (/$ey/i and (not /$en/i)); + } + } $i++; - } - $log->thaw(); $win_pb->destroy(); } @@ -393,6 +449,9 @@ sub destroy_window { # log # $Log$ +# Revision 1.10 2001/08/01 17:30:21 yduret +# added mapping.. +# # Revision 1.9 2001/08/01 13:19:14 yduret # ask_many_from_list # |