Class: ServerClient
- Inherits:
-
Sinatra::Base
- Object
- Sinatra::Base
- ServerClient
- Defined in:
- lib/icwot/server_client.rb
Class Method Summary collapse
-
.create_or_open_log ⇒ Object
Si le fichier log/msg.log n’existe pas, on le créé, sinon on l’ouvre.
Class Method Details
.create_or_open_log ⇒ Object
Si le fichier log/msg.log n’existe pas, on le créé, sinon on l’ouvre
6 7 8 9 10 11 12 13 |
# File 'lib/icwot/server_client.rb', line 6 def self.create_or_open_log file_name = "icwot-#{settings.port}-msg.log" directory_path = "#{Dir.home}/log/" Dir.mkdir(directory_path) unless File.exists?(directory_path) file = (settings.log_path.nil? || !File.exist?(settings.log_path) ? File.new(directory_path+file_name, 'a+') : File.new(settings.log_path)) file.sync = true file end |