Class: OpenC3::StreamLogPair
- Defined in:
- lib/openc3/logs/stream_log_pair.rb
Overview
Holds a read/write pair of stream logs
Instance Attribute Summary collapse
-
#read_log ⇒ StreamLog
The read log.
-
#write_log ⇒ StreamLog
The write log.
Instance Method Summary collapse
- #cleanup ⇒ Object
-
#clone ⇒ Object
Clone the stream log pair.
-
#initialize(name, params = []) ⇒ StreamLogPair
constructor
A new instance of StreamLogPair.
-
#name=(name) ⇒ Object
Change the stream log name.
- #shutdown ⇒ Object
-
#start ⇒ Object
Start stream logs.
-
#stop ⇒ Object
Close any open stream log files.
Constructor Details
#initialize(name, params = []) ⇒ StreamLogPair
Returns a new instance of StreamLogPair.
26 27 28 29 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 26 def initialize(name, params = []) @read_log = StreamLog.new(name, :READ, *params) @write_log = StreamLog.new(name, :WRITE, *params) end |
Instance Attribute Details
#read_log ⇒ StreamLog
Returns The read log.
20 21 22 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 20 def read_log @read_log end |
#write_log ⇒ StreamLog
Returns The write log.
22 23 24 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 22 def write_log @write_log end |
Instance Method Details
#cleanup ⇒ Object
57 58 59 60 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 57 def cleanup @read_log.cleanup @write_log.cleanup end |
#clone ⇒ Object
Clone the stream log pair
63 64 65 66 67 68 69 70 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 63 def clone stream_log_pair = super() stream_log_pair.read_log = @read_log.clone stream_log_pair.write_log = @write_log.clone stream_log_pair.read_log.start if @read_log.logging_enabled stream_log_pair.write_log.start if @write_log.logging_enabled stream_log_pair end |
#name=(name) ⇒ Object
Change the stream log name
33 34 35 36 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 33 def name=(name) @read_log.name = name @write_log.name = name end |
#shutdown ⇒ Object
51 52 53 54 55 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 51 def shutdown threads = @read_log.shutdown threads.concat(@write_log.shutdown) return threads end |
#start ⇒ Object
Start stream logs
39 40 41 42 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 39 def start @read_log.start @write_log.start end |
#stop ⇒ Object
Close any open stream log files
45 46 47 48 49 |
# File 'lib/openc3/logs/stream_log_pair.rb', line 45 def stop threads = @read_log.stop threads.concat(@write_log.stop) return threads end |