Move sample data logger to own module

This commit is contained in:
Maikel Linke
2019-01-08 14:27:25 +11:00
parent fae05ff713
commit bec9f5eb2e
2 changed files with 10 additions and 8 deletions

View File

@@ -1,3 +1,5 @@
require "tasks/sample_data/logging"
# The sample data generated by this task is supposed to save some time during
# manual testing. It is not meant to be complete, but we try to improve it
# over time. How much is hardcoded here is a trade off between developer time
@@ -44,14 +46,6 @@ namespace :openfoodnetwork do
Spree::State.count > 0
end
module Logging
private
def log(message)
puts "[openfoodnetwork:sample_data:load] #{message}"
end
end
module Addressing
private

View File

@@ -0,0 +1,8 @@
module Logging
private
def log(message)
@logger ||= ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
@logger.tagged("openfoodnetwork:sample_data:load") { @logger.info(message) }
end
end