This is an automated email from the ASF dual-hosted git repository.

curcuru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git


The following commit(s) were added to refs/heads/master by this push:
     new 53d20d6  Allow display of logs.cgi?week all error logs in dir
53d20d6 is described below

commit 53d20d66a4e7f74c47ea1845f50e1456ddd0fcca
Author: Shane Curcuru <[email protected]>
AuthorDate: Tue May 8 09:19:51 2018 -0400

    Allow display of logs.cgi?week all error logs in dir
---
 lib/whimsy/logparser.rb | 11 ++++++-----
 www/members/logs.cgi    |  9 +++++----
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/lib/whimsy/logparser.rb b/lib/whimsy/logparser.rb
index 47d8591..be40fd0 100755
--- a/lib/whimsy/logparser.rb
+++ b/lib/whimsy/logparser.rb
@@ -196,15 +196,16 @@ module LogParser
   end
   
   # Get a list of all current|available error logs interesting entries
+  # @param current - only scan current day? or scan all week's logs
   # @param d directory to scan for *error.log*
   # @return hash of arrays of interesting entries
-  def get_errors(d = ERROR_LOG_DIR, current = true)
+  def get_errors(current, dir: ERROR_LOG_DIR)
     if current
-      logs = LogParser.parse_whimsy_error(File.join(d, 'whimsy_error.log'))
-      LogParser.parse_error_log(File.join(d, 'error.log'), logs)
+      logs = LogParser.parse_whimsy_error(File.join(dir, 'whimsy_error.log'))
+      LogParser.parse_error_log(File.join(dir, 'error.log'), logs)
     else
-      logs = LogParser.parse_whimsy_errors(d)
-      LogParser.parse_error_logs(d, logs)
+      logs = LogParser.parse_whimsy_errors(dir)
+      LogParser.parse_error_logs(dir, logs)
     end
     return logs.sort.to_h # Sort by time order
   end
diff --git a/www/members/logs.cgi b/www/members/logs.cgi
index a2b76ec..748ec34 100755
--- a/www/members/logs.cgi
+++ b/www/members/logs.cgi
@@ -8,15 +8,15 @@ require 'wunderbar/bootstrap'
 require 'whimsy/logparser'
 
 # Emit table of interesting error logs
-def display_errors()
+def display_errors(current)
   _whimsy_panel_table(
     title: 'Partial error listing',
     helpblock: -> {
-      _ 'This only includes a subset of possibly interesting error log 
entries.'
+      _ "This only includes a subset of possibly interesting error log entries 
from the #{current ? 'current day' : 'past week'}."
       _a 'See the full server logs directory.', href: '/members/log'
     }
   ) do
-    logs = LogParser.get_errors()
+    logs = LogParser.get_errors(current)
     _table.table.table_hover.table_striped do
       _thead_ do
         _tr do
@@ -139,7 +139,8 @@ _html do
       if ENV['QUERY_STRING'].include? 'access'
         display_access()
       else
-        display_errors()
+        # Append ?week to search all *.log|*.log.gz in dir
+        display_errors(!ENV['QUERY_STRING'].include?('week'))
       end
     end
   end

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to