Commit 7d125f1a authored by Toon Claes's avatar Toon Claes

Use Gitlab::Geo::LogHelpers where possible

parent 9190e081
......@@ -17,6 +17,8 @@ module Geo
# The `build_event` method is supposed to return an instance of the event
# that will be logged.
class EventStore
include ::Gitlab::Geo::ProjectLogHelpers
class << self
attr_accessor :event_type
end
......@@ -43,20 +45,5 @@ module Geo
raise NotImplementedError,
"#{self.class} does not implement #{__method__}"
end
def log_error(message, error)
Gitlab::Geo::Logger.error({
class: self.class.name,
message: message,
error: error
}.merge(log_params))
end
def log_params
{
project_id: project.id,
project_path: project.full_path
}
end
end
end
......@@ -3,6 +3,7 @@ module Geo
include Sidekiq::Worker
include CronjobQueue
include ExclusiveLeaseGuard
include ::Gitlab::Geo::LogHelpers
LEASE_TIMEOUT = 60.minutes
......@@ -10,11 +11,6 @@ module Geo
LEASE_TIMEOUT
end
def log_error(message, extra_args = {})
args = { class: self.class.name, message: message }.merge(extra_args)
Gitlab::Geo::Logger.error(args)
end
def perform
return unless Gitlab::Geo.primary?
......
......@@ -7,9 +7,10 @@ module Gitlab
Gitlab::Geo::Logger.info(data)
end
def log_error(message, error)
def log_error(message, error = nil, details = {})
data = base_log_data(message)
data[:error] = error.to_s
data[:error] = error.to_s if error
data.merge!(details) if details
Gitlab::Geo::Logger.error(data)
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment