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
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