module LogManager
Attributes
compress[RW]
rotation_frequency[RW]
saved_files[RW]
Public Class Methods
file_path()
click to toggle source
# File lib/log_manager.rb, line 57 def self.file_path File.join(Dir.pwd, 'config', "log_manager.yml") end
hi()
click to toggle source
# File lib/log_manager.rb, line 11 def self.hi "Hi #{self.project_name}, If you are looking for a gem that helps you manage your log and also make your day awesome, You just found it!" end
log_rotate()
click to toggle source
# File lib/log_manager.rb, line 19 def self.log_rotate File.open(self.project_name, "w") do |f| f.puts(self.path + '/log/*.log {') f.puts(' ' + @rotation_frequency) f.puts(' missingok') f.puts(' rotate ' + @saved_files.to_s) if @compress f.puts(' compress') f.puts(' delaycompress') end f.puts(' notifempty') f.puts(' copytruncate') f.puts('}') end return true end
path()
click to toggle source
# File lib/log_manager.rb, line 15 def self.path Dir.pwd.to_s end
project_name()
click to toggle source
# File lib/log_manager.rb, line 36 def self.project_name self.path.split('/').last end
setup(enviroment = 'development')
click to toggle source
# File lib/log_manager.rb, line 40 def self.setup enviroment = 'development' if self.validate_file config = YAML::load(File.open(LogManager.file_path)) enviroment_config = config[enviroment] @rotation_frequency = enviroment_config['rotation_frequency'] @saved_files = enviroment_config['saved_files'] @compress = enviroment_config['compress'] return true else "File doesnt exists yet, please run 'rails generate log_manager:install" end end
validate_file()
click to toggle source
# File lib/log_manager.rb, line 53 def self.validate_file File.exist?(LogManager.file_path) end