Class: LS4::LogService
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Service
init
#ebus_bind!, #ebus_connect, extended
#ebus_all_slots, #ebus_disconnect!
#connect, #ebus_all_slots, #ebus_call_log, #ebus_call_slots, #ebus_signal_error, #ebus_signal_log, #ebus_signal_slots
#call_slot, #signal_slot
Constructor Details
Returns a new instance of LogService.
25
26
27
|
# File 'lib/ls4/service/log.rb', line 25
def initialize
@out = nil
end
|
Class Method Details
.open! ⇒ Object
29
30
31
|
# File 'lib/ls4/service/log.rb', line 29
def self.open!
init.open
end
|
Instance Method Details
#log_event_bus ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/ls4/service/log.rb', line 58
def log_event_bus
$log.on_trace do
LS4.constants.each {|const|
klass = LS4.const_get(const)
if klass.is_a?(Class) && klass < Bus
bus = klass
name = bus.name.gsub('LS4::','')
$log.trace name
bus.ebus_all_slots.each {|s|
s = s.to_s.gsub('LS4::','')
$log.trace " #{s}"
}
end
}
end
end
|
#on_sighup ⇒ Object
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/ls4/service/log.rb', line 40
def on_sighup
if path = ConfigBus.get_log_path
out = File.open(path, "a")
if @out
@out.close
@out = nil
end
@out = $log.out = out
end
end
|
#open ⇒ Object
33
34
35
36
37
38
|
# File 'lib/ls4/service/log.rb', line 33
def open
if path = ConfigBus.get_log_path
out = File.open(path, "a")
@out = $log.out = out
end
end
|
#shutdown ⇒ Object
51
52
53
54
55
56
|
# File 'lib/ls4/service/log.rb', line 51
def shutdown
if @out
@out.close
@out = nil
end
end
|