class Sawmill::Rotater::Base

This class defines the rotation strategy contract. Classes that implement rotation strategies need not subclass this base class, but must implement the methods defined here.

This base class itself merely writes to STDOUT and does not do any rotation.

Public Instance Methods

before_write() click to toggle source

This is a hook that is called before every write request to any stream managed by this rotater. You may optionally perform any periodic tasks here, such as renaming log files.

# File lib/sawmill/rotater/base.rb, line 81
def before_write
end
close_handle(handle_, io_) click to toggle source

Close the IO object for the given handle. This is guaranteed not be called unless the stream has been opened.

# File lib/sawmill/rotater/base.rb, line 73
def close_handle(handle_, io_)
end
open_handle(handle_) click to toggle source

Open and return an IO object for the given handle. This is guaranteed not to be called twice unless the stream has been closed in the meantime.

# File lib/sawmill/rotater/base.rb, line 65
def open_handle(handle_)
  ::STDOUT
end
preferred_handle() click to toggle source

Return the currently preferred handle, identifying which io stream should be written to preferentially unless a channel is constrained to use an earlier stream.

# File lib/sawmill/rotater/base.rb, line 56
def preferred_handle
  0
end