Don't include recorded_at with broadcast line

Receiving end will already add that
This commit is contained in:
David Heinemeier Hansson
2023-02-18 16:33:12 +01:00
parent 0a51cd0899
commit 1973f55c58

View File

@@ -4,7 +4,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
# Runs remotely # Runs remotely
def record(line) def record(line)
append \ append \
[ :echo, tagged_line(line) ], [ :echo, tagged_record_line(line) ],
audit_log_file audit_log_file
end end
@@ -12,7 +12,7 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
def broadcast(line) def broadcast(line)
if broadcast_cmd = config.audit_broadcast_cmd if broadcast_cmd = config.audit_broadcast_cmd
pipe \ pipe \
[ :echo, tagged_line(line) ], [ :echo, tagged_broadcast_line(line) ],
broadcast_cmd broadcast_cmd
end end
end end
@@ -26,19 +26,19 @@ class Mrsk::Commands::Auditor < Mrsk::Commands::Base
"mrsk-#{config.service}-audit.log" "mrsk-#{config.service}-audit.log"
end end
def tagged_line(line) def tagged_record_line(line)
"'#{tags} #{line}'" "'#{recorded_at_tag} #{performer_tag} #{line}'"
end end
def tags def tagged_broadcast_line(line)
"[#{recorded_at}] [#{performer}]" "'#{performer_tag} #{line}'"
end end
def performer def performer_tag
@performer ||= `whoami`.strip "[#{`whoami`.strip}]"
end end
def recorded_at def recorded_at_tag
Time.now.to_fs(:db) "[#{Time.now.to_fs(:db)}]"
end end
end end