class Bauxite::Loggers::FileLogger

File logger.

This logger outputs the raw action text for every action executed to the file specified in the file logger option.

Public Class Methods

new(options) click to toggle source

Constructs a new echo logger instance.

Calls superclass method Bauxite::Loggers::NullLogger.new
# File lib/bauxite/loggers/file.rb, line 31
def initialize(options)
        super(options)
        @file = options[:file]
        unless @file and @file != ''
                raise ArgumentError, "FileLogger configuration error: Undefined 'file' option."
        end
        File.open(@file, "w") {} # truncate file
end

Public Instance Methods

log_cmd(action) { || ... } click to toggle source

Echoes the raw action text.

# File lib/bauxite/loggers/file.rb, line 41
def log_cmd(action)
        File.open(@file, 'a+') { |f| f.write(action.text+"\n") }
        yield
end