Skip to content
Snippets Groups Projects
Commit 59fbf946 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- fixed problem if from and to date used

- show all matches
parent d44c84a6
No related branches found
No related tags found
No related merge requests found
...@@ -35,11 +35,9 @@ sub opt_spec { ...@@ -35,11 +35,9 @@ sub opt_spec {
["colorize|c" => "colorize output"], ["colorize|c" => "colorize output"],
["csv" => "use csv output"], ["csv" => "use csv output"],
]}], ]}],
["datemode" => hidden => {one_of => [ ["last-24h" => "search within last 24h"],
["last-24h" => "search within last 24h"], ["fromdate=s" => "search starting with date"],
["fromdate=s" => "search starting with date"], ["todate=s" => "search ending with date"],
["todate=s" => "search ending with date"],
] } ],
["level=s@" => "levels to search for. Levels could be: 'error', 'warn', 'info', debug. You could use multiple levels by repeating"], ["level=s@" => "levels to search for. Levels could be: 'error', 'warn', 'info', debug. You could use multiple levels by repeating"],
["match=s" => "perl regex to search for" => {default=>".*"}], ["match=s" => "perl regex to search for" => {default=>".*"}],
); );
...@@ -124,9 +122,9 @@ sub create_regex_from_to { ...@@ -124,9 +122,9 @@ sub create_regex_from_to {
|| $line =~ s/ (INFO) / ${green}$1${reset} / || $line =~ s/ (INFO) / ${green}$1${reset} /
|| $line =~ s/ (WARN) / ${red}$1${reset} / || $line =~ s/ (WARN) / ${red}$1${reset} /
|| $line =~ s/ (ERROR) / ${bred}$1${reset} /; || $line =~ s/ (ERROR) / ${bred}$1${reset} /;
$line =~ s/(SIP ?\d+)/${back_yellow}$1${reset}/; $line =~ s/(SIP ?\d+)/${back_yellow}$1${reset}/g;
$line =~ s/(IE ?\d+)/${back_yellow}$1${reset}/; $line =~ s/(IE ?\d+)/${back_yellow}$1${reset}/g;
$line =~ s/(dc.identifier)/${back_cyan}$1${reset}/; $line =~ s/(dc.identifier)/${back_cyan}$1${reset}/g;
return $line; return $line;
} }
} }
...@@ -164,12 +162,7 @@ sub execute { ...@@ -164,12 +162,7 @@ sub execute {
my $date_rx=qr/[^ ]*/; my $date_rx=qr/[^ ]*/;
if (defined $opt->last_24h and $opt->last_24h == 1) { if (defined $opt->last_24h and $opt->last_24h == 1) {
$date_rx=create_regex_last24h(); $date_rx=create_regex_last24h();
} elsif (defined $opt->datemode } else {
and (
$opt->datemode eq "todate"
or $opt->datemode eq "fromdate"
)
) {
$date_rx=create_regex_from_to($opt->fromdate, $opt->todate); $date_rx=create_regex_from_to($opt->fromdate, $opt->todate);
} }
# create level_rx if multiple levels provided by CLI # create level_rx if multiple levels provided by CLI
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment