mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-05 22:26:07 +00:00
Move sample data logger to own module
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
8
lib/tasks/sample_data/logging.rb
Normal file
8
lib/tasks/sample_data/logging.rb
Normal 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
|
||||
Reference in New Issue
Block a user