Class: Libis::Workflow::Mongoid::Job
- Inherits:
-
Object
- Object
- Libis::Workflow::Mongoid::Job
- Includes:
- Base::Job, Base
- Defined in:
- lib/libis/workflow/mongoid/job.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#execute(opts = {}) ⇒ Object
noinspection RubyStringKeysInHashInspection.
- #logger ⇒ Object
Methods included from Base
Class Method Details
Instance Method Details
#execute(opts = {}) ⇒ Object
noinspection RubyStringKeysInHashInspection
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/libis/workflow/mongoid/job.rb', line 65 def execute(opts = {}) opts['run_config'] ||= {} if self.log_each_run opts['run_config']['log_to_file'] = true opts['run_config']['log_level'] = self.log_level end if (run_name = opts.delete('run_name')) opts['run_config']['run_name'] = run_name end super opts end |
#logger ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/libis/workflow/mongoid/job.rb', line 43 def logger return ::Libis::Workflow::Mongoid::Config.logger unless self.log_to_file logger = ::Logging::Repository.instance[self.name] return logger if logger unless ::Logging::Appenders[self.name] ::Logging::Appenders::RollingFile.new( self.name, filename: File.join(::Libis::Workflow::Mongoid::Config[:log_dir], "#{self.name}.{{%Y%m%d}}.log"), layout: ::Libis::Workflow::Mongoid::Config.get_log_formatter, truncate: true, age: self.log_age, keep: self.log_keep, roll_by: 'date', level: self.log_level ) end logger = ::Libis::Workflow::Mongoid::Config.logger(self.name, self.name) logger.additive = false logger end |