From f9db304c8f7c73efee9c881c1b0ddbac3c75633e Mon Sep 17 00:00:00 2001 From: Miguel Nogueira Date: Mon, 20 May 2024 10:15:36 +0100 Subject: [PATCH] feat(date): add explanatory comment, line separators for output Signed-off-by: Miguel Nogueira --- main.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.rb b/main.rb index 5601f71..5182a2e 100644 --- a/main.rb +++ b/main.rb @@ -46,6 +46,7 @@ def get_line_date(line) match = line.match(pattern)[0] else raise StandardError("Invalid datetime data detected!") + # Tests would help find the bug... end # [12/Apr/2023:13:56:41 +0100] -> 12/Apr/2023:13:56:41 +0100 -> Apr/2023 Date.parse(match.gsub('[', '').gsub(']', '')).strftime('%b/%Y') @@ -159,7 +160,8 @@ top_client_errors.each do |ip, count| end monthly_visits.each do |ip, visits| - puts "IP #{ip} had the following visits:" + puts "------------ BY DATE ---------------" + puts("IP #{ip} had the following visits:") visits.each do |date, count| puts "#{date}: #{count} visits" end