Class: Flor::TransientExecutor::TransientLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/flor/core/texecutor.rb

Instance Method Summary collapse

Constructor Details

#initialize(unit) ⇒ TransientLogger

Returns a new instance of TransientLogger.



46
47
48
49
50
51
# File 'lib/flor/core/texecutor.rb', line 46

def initialize(unit)

  @unit = unit

  @out = Flor::Logger::Out.prepare(unit)
end

Instance Method Details

#log_err(executor, message, opts = {}) ⇒ Object



61
62
63
64
65
66
67
# File 'lib/flor/core/texecutor.rb', line 61

def log_err(executor, message, opts={})

  return unless @unit.conf['log_err']

  @out.puts(
    Flor.msg_to_detail_s(executor, message, opts.merge(flag: true)))
end

#log_src(source, opts, log_opts = {}) ⇒ Object



69
70
71
72
73
74
# File 'lib/flor/core/texecutor.rb', line 69

def log_src(source, opts, log_opts={})

  return unless @unit.conf['log_src']

  @out.puts(Flor.src_to_s(source, opts, log_opts))
end

#log_tree(tree, nid = '0', opts = {}) ⇒ Object



76
77
78
79
80
81
# File 'lib/flor/core/texecutor.rb', line 76

def log_tree(tree, nid='0', opts={})

  return unless @unit.conf['log_tree']

  @out.puts(Flor.tree_to_s(tree, nid, opts.merge(out: @out)))
end

#notify(executor, message) ⇒ Object



53
54
55
56
57
58
59
# File 'lib/flor/core/texecutor.rb', line 53

def notify(executor, message)

  return if message['point'] == 'end'
  return unless @unit.conf['log_msg']

  @out.puts(Flor.message_to_one_line_s(executor, message, out: @out))
end