Sha256: a2a22bc3114b2bd6f7362ffa4f8c8bcfc71648fd4b81fb9738db260b34686c1e
Contents?: true
Size: 847 Bytes
Versions: 2
Compression:
Stored size: 847 Bytes
Contents
# frozen_string_literal: true # Scope Rails module R2OAS module TaskLogging def task(*args, &block) Rake::Task.define_task(*args) do |task| if block_given? debug_log task, "[#{task.name}] started" begin block.call(task) debug_log task, "[#{task.name}] finished" rescue StandardError => e debug_log task, "[#{task.name}] failed" raise e end end end end private def start logger.info '[R2-OAS] start' yield logger.info '[R2-OAS] end' end def logger R2OAS.logger end def set_debug_level R2OAS.logger.level = StdoutLogger::DEBUG end def debug_log(task, message) R2OAS.logger.debug message.to_s unless task.name == 'routes:oas:debug' end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
r2-oas-0.3.4 | lib/r2-oas/task_logging.rb |
r2-oas-0.3.3 | lib/r2-oas/task_logging.rb |