Sha256: 5c6ca7417c056e8112efc6ad6198afdaa8afc36a58670af4c473366c90d7a622

Contents?: true

Size: 745 Bytes

Versions: 8

Compression:

Stored size: 745 Bytes

Contents

require "log4r/outputter/outputter"
require "time"

module Log4r
  class DeploymentTrackerOutputter < Outputter
    def initialize(name, hash = {})
      super(name, hash)
      @logger = Log4r::Logger.new("vagrant_orchestrate::log4r::deployment_tracker_outputter")
    end

    private

    def canonical_log(event)
      data = {}
      data["type"] = event.fullname
      data["timestamp"] = Time.now.getutc.iso8601
      data["level"] = LNAMES[event.level]
      data["message"] = event.data

      begin
        id = VagrantPlugins::Orchestrate::DEPLOYMENT_ID
        DeploymentTrackerClient::DefaultApi.post_logs(id, [data])
      rescue
        @logger.warn "Unable to send log messages to deployment-tracker"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vagrant-orchestrate-0.8.0 lib/log4r/outputter/deployment_tracker_outputter.rb
vagrant-orchestrate-0.8.0.pre.3 lib/log4r/outputter/deployment_tracker_outputter.rb
vagrant-orchestrate-0.8.0.pre.2 lib/log4r/outputter/deployment_tracker_outputter.rb
vagrant-orchestrate-0.8.0.pre.1 lib/log4r/outputter/deployment_tracker_outputter.rb
vagrant-orchestrate-0.7.2 lib/log4r/outputter/deployment_tracker_outputter.rb
vagrant-orchestrate-0.7.1 lib/log4r/outputter/deployment_tracker_outputter.rb
vagrant-orchestrate-0.7.0 lib/log4r/outputter/deployment_tracker_outputter.rb
vagrant-orchestrate-0.7.0.pre.5 lib/log4r/outputter/deployment_tracker_outputter.rb