Add log slimming function

Change-Id: I0f8878a9eded0394df9f0aa0a1a9a8fc04410a28
diff --git a/script/korapxml2krill b/script/korapxml2krill
index a1dac4d..d09786c 100644
--- a/script/korapxml2krill
+++ b/script/korapxml2krill
@@ -157,6 +157,7 @@
 #
 # 2022/01/17
 # - Support for temporary extraction in config
+# - Introduced support for Gingko
 # ----------------------------------------------------------
 
 our $LAST_CHANGE = '2022/01/17';
@@ -305,6 +306,29 @@
   'Stderr', log_level => uc($cfg{log} // 'ERROR')
 );
 
+# Start log slimming
+if ($cmd && $cmd eq 'slimlog') {
+  require KorAP::XML::Log::Slim;
+
+  my $log_file = shift @ARGV;
+
+  if (-e $log_file) {
+
+    my $slimmer = KorAP::XML::Log::Slim->new($log_file);
+
+    # Run log filter
+    $slimmer->slim_to;
+  }
+
+  else {
+    warn "Log file can't be found";
+    exit(1);
+  };
+
+  exit;
+};
+
+
 if ($cmd && $output && (!defined($to_tar)) && (!-e $output || !-d $output)) {
   $log->error("Directory '$output' does not exist.");
   exit 1;
@@ -316,7 +340,6 @@
 # Gzip has no effect, if no output is given
 pod2usage(%ERROR_HASH) if $gzip && !$output;
 
-
 # Start serial processing
 if ($cmd && $cmd eq 'serial') {
 
@@ -1072,6 +1095,14 @@
 the output will be a tar file.
 
 
+=item B<slimlog>
+
+  $ korapxml2krill slimlog <logfile> > <logfile-slim>
+
+Filters out all useless aka succesfull information from logs, to simplify
+log checks. Expects no further options.
+
+
 =back