From 1973f55c5823c796b1087de9e81cebc4ae41f422 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 18 Feb 2023 16:33:12 +0100 Subject: [PATCH] Don't include recorded_at with broadcast line Receiving end will already add that --- lib/mrsk/commands/auditor.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/mrsk/commands/auditor.rb b/lib/mrsk/commands/auditor.rb index dbd8698e..8967b0ed 100644 --- a/lib/mrsk/commands/auditor.rb +++ b/lib/mrsk/commands/auditor.rb @@ -4,7 +4,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base # Runs remotely def record(line) append \ - [ :echo, tagged_line(line) ], + [ :echo, tagged_record_line(line) ], audit_log_file end @@ -12,7 +12,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base def broadcast(line) if broadcast_cmd = config.audit_broadcast_cmd pipe \ - [ :echo, tagged_line(line) ], + [ :echo, tagged_broadcast_line(line) ], broadcast_cmd end end @@ -26,19 +26,19 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base "mrsk-#{config.service}-audit.log" end - def tagged_line(line) - "'#{tags} #{line}'" + def tagged_record_line(line) + "'#{recorded_at_tag} #{performer_tag} #{line}'" end - def tags - "[#{recorded_at}] [#{performer}]" + def tagged_broadcast_line(line) + "'#{performer_tag} #{line}'" end - def performer - @performer ||= `whoami`.strip + def performer_tag + "[#{`whoami`.strip}]" end - def recorded_at - Time.now.to_fs(:db) + def recorded_at_tag + "[#{Time.now.to_fs(:db)}]" end end