comply with new common signature

arnaud sellenet committed Apr 14, 2014
commit 11cc5446f428ffd554fee7753e34f273fc661404
Showing 3 changed files with 2 additions and 49 deletions
locomotive/wagon/logger.rb b/lib/locomotive/wagon/logger.rb +0 -47
@@ @@ -1,47 +0,0 @@
- module Locomotive
- module Wagon
-
- class Logger
- attr_accessor :logger, :logfile_path, :stdout
-
- def initialize
- self.logger = nil
- end
-
- # Setup the single instance of the ruby logger.
- #
- # @param [ String ] path The path to the log file (default: log/wagon.log)
- # @param [ Boolean ] stdout Instead of having a file, log to the standard output
- #
- def setup(path, stdout = false)
- require 'logger'
-
- self.stdout = stdout
-
- self.logfile_path = File.expand_path(File.join(path, 'log', 'wagon.log'))
- FileUtils.mkdir_p(File.dirname(logfile_path))
-
- out = self.stdout ? STDOUT : self.logfile_path
-
- self.logger = ::Logger.new(out).tap do |log|
- log.level = ::Logger::DEBUG
- log.formatter = proc do |severity, datetime, progname, msg|
- "#{msg}\n"
- end
- end
- end
-
- def self.instance
- @@instance ||= self.new
- end
-
- def self.setup(path, stdout = false)
- self.instance.setup(path, stdout)
- end
-
- def method_missing method, *args
- self.logger.send method, args
- end
- end
- end
- end
\ No newline at end of file
locomotive/wagon/standalone_server.rb b/lib/locomotive/wagon/standalone_server.rb +1 -1
@@ @@ -10,7 +10,7 @@ module Locomotive
class StandaloneServer < Locomotive::Steam::Server
def initialize(path)
- Locomotive::Common::Logger.setup(path, false)
+ Locomotive::Common::Logger.setup(File.expand_path(File.join(path, 'log', 'wagon.log')))
# get the reader
reader = Locomotive::Mounter::Reader::FileSystem.instance
spec/support/helpers.rb +1 -1
@@ @@ -17,7 +17,7 @@ module Spec
def run_server
path = 'spec/fixtures/default'
- Locomotive::Common::Logger.setup(path, false)
+ Locomotive::Common::Logger.setup(File.expand_path(File.join(path, 'log', 'wagon.log')))
reader = Locomotive::Mounter::Reader::FileSystem.instance
reader.run!(path: path)
Locomotive::Steam::Server.new(reader, disable_listen: true)