Class: InstanceAgent::DeploymentLog
- Inherits:
-
Object
- Object
- InstanceAgent::DeploymentLog
- Includes:
- Singleton
- Defined in:
- lib/instance_agent/log.rb
Instance Method Summary collapse
-
#initialize ⇒ DeploymentLog
constructor
A new instance of DeploymentLog.
- #log(message) ⇒ Object
Constructor Details
#initialize ⇒ DeploymentLog
Returns a new instance of DeploymentLog.
9 10 11 12 13 14 15 16 |
# File 'lib/instance_agent/log.rb', line 9 def initialize deployment_logs_dir = File.join(InstanceAgent::Config.config[:root_dir], 'deployment-logs') FileUtils.mkdir_p(deployment_logs_dir) unless File.exists? deployment_logs_dir @deployment_log ||= Logger.new(File.join(deployment_logs_dir, "#{InstanceAgent::Config.config[:program_name]}-deployments.log"), 8, 64 * 1024 * 1024) @deployment_log.formatter = proc do |severity, datetime, progname, msg| "[#{datetime.strftime('%Y-%m-%d %H:%M:%S.%L')}] #{msg}\n" end end |
Instance Method Details
#log(message) ⇒ Object
18 19 20 |
# File 'lib/instance_agent/log.rb', line 18 def log() @deployment_log.info() end |