whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curc...@apache.org
Subject [whimsy] 01/02: Make app list const and provide default file path
Date Mon, 07 May 2018 23:24:48 GMT
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

commit fa6c839d118696a54245ab01f45ef18b27071fd0
Author: Shane Curcuru <asf@shanecurcuru.org>
AuthorDate: Mon May 7 19:22:30 2018 -0400

    Make app list const and provide default file path
---
 lib/whimsy/logparser.rb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/whimsy/logparser.rb b/lib/whimsy/logparser.rb
index 6250b79..842e541 100755
--- a/lib/whimsy/logparser.rb
+++ b/lib/whimsy/logparser.rb
@@ -13,6 +13,7 @@ module LogParser
   ERROR_LOG_DIR = '/srv/whimsy/www/members/log'
   
   # Constants and ignored regex for whimsy_access logs
+  WHIMSY_APPS = %w(status roster board public secretary)
   RUSER = 'remote_user'
   REFERER = 'referer'
   REMAINDER = 'remainder'
@@ -77,11 +78,11 @@ module LogParser
   
   # Collate/partition whimsy_access entries by app areas
   # @param logs full set of items to scan
-  # @return apps - apps categorized, with REMAINDER entry all others
+  # @return apps - WHIMSY_APPS categorized, with REMAINDER entry all others
   def collate_whimsy_access(logs)
     remainder = logs
     apps = {}
-    %w(status roster board public secretary).each do |a|
+    WHIMSY_APPS.each do |a|
       apps[a] = Hash.new{|h,k| h[k] = [] }
       apps[a][RUSER] = Hash.new{|h,k| h[k] = 0 }
       apps[a][REFERER] = Hash.new{|h,k| h[k] = 0 }
@@ -112,7 +113,7 @@ module LogParser
   # Get a simplistic hash report of access entries
   # @param f filepath to whimsy_access.log
   # @return app_report, misses_data
-  def get_access_reports(f)
+  def get_access_reports(f = File.join(ERROR_LOG_DIR, 'whimsy_access.log'))
     access = parse_whimsy_access(f)
     hits, miss = access.partition{ |l| l['status'] == 200 }
     apps = collate_whimsy_access(hits)

-- 
To stop receiving notification emails like this one, please contact
curcuru@apache.org.

Mime
View raw message