A channel is a lightweight object that responds to the write and close methods; that is, it is sufficient for Sawmill::Formatter.
When a channel is opened, it locks down a path to the logfile and ensures that the logfile will not rotate out from under it; that is, writes to a channel are ensured to end up in the same physical file.
You may choose, at intervals, to explicitly tell the channel that it is okay to rotate the logfile now, by calling check_rotate.
You must close a channel when you are done with it. Closing a channel does not close the underlying logfile, but instead tells the rotater that you are done with this channel and that the logfile is free to rotate independent of it.
You may have any number of channels open at any time, each on a different rotation schedule. Each may possibly be writing to different files in the rotation at any time, but this is all done automatically behind the scenes.
Manually tell the rotater that this channel is at a stopping point and that the log file may rotate at this time.
# File lib/sawmill/rotater.rb, line 267 def check_rotate if @io_handle @io_handle = @rotater._do_check_rotate(@io_handle) end end
Close this channel, telling the rotater that this channel no longer needs to constrain the log rotation.
# File lib/sawmill/rotater.rb, line 256 def close if @io_handle @rotater._do_close(@io_handle) @io_handle = nil end end
Write a string to this channel.
# File lib/sawmill/rotater.rb, line 246 def write(str_) if @io_handle @rotater._do_write(@io_handle, str_, @auto_rotate) end end