Class: Raykit::LogEvent
- Inherits:
-
Hash
- Object
- Hash
- Raykit::LogEvent
- Defined in:
- lib/raykit/logevent.rb
Overview
:verbose, :debug, :information, :error, :fatal
Instance Method Summary collapse
-
#initialize(level, messageTemplate, properties) ⇒ LogEvent
constructor
A new instance of LogEvent.
- #to_seq ⇒ Object
Constructor Details
#initialize(level, messageTemplate, properties) ⇒ LogEvent
Returns a new instance of LogEvent.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/raykit/logevent.rb', line 8 def initialize(level, , properties) self["Timestamp"] = DateTime.now.iso8601 self["Level"] = level self["Message"] = self["MessageTemplate"] = properties["MachineName"] = Raykit::Environment.machine unless properties.key?("MachineName") properties["UserName"] = Raykit::Environment.user unless properties.key?("UserName") properties["RakeDirectory"] = ::Rake.application.original_dir self["Properties"] = properties end |
Instance Method Details
#to_seq ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/raykit/logevent.rb', line 19 def to_seq unless ENV["SEQ_SERVER"].nil? cmd_str = "seqcli log -m \"#{self["Message"].gsub('"', "")}\" -l #{self["Level"]} -s #{ENV["SEQ_SERVER"]}" self["Properties"].each do |k, v| cmd_str += " -p \"#{k}=#{v}\"" end puts `#{cmd_str}` end end |