Class: Airbrussh::LogFileFormatter
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Airbrussh::LogFileFormatter
- Defined in:
- lib/airbrussh/log_file_formatter.rb
Overview
A Pretty formatter that sends its output to a specified log file path. LogFileFormatter takes care of creating the file (and its parent directory) if it does not already exist, opens it for appending, and writes a delimiter message. The file is automatically rotated if it reaches 20 MB.
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, formatter_class = SSHKit::Formatter::Pretty) ⇒ LogFileFormatter
constructor
A new instance of LogFileFormatter.
Constructor Details
#initialize(path, formatter_class = SSHKit::Formatter::Pretty) ⇒ LogFileFormatter
Returns a new instance of LogFileFormatter.
15 16 17 18 19 20 |
# File 'lib/airbrussh/log_file_formatter.rb', line 15 def initialize(path, formatter_class=SSHKit::Formatter::Pretty) @path = path ensure_directory_exists if path.is_a?(String) super(formatter_class.new(log_file_io)) write_delimiter end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
13 14 15 |
# File 'lib/airbrussh/log_file_formatter.rb', line 13 def path @path end |