class Logtail::Contexts::System

The system context tracks OS level process information, such as the process ID.

@note This is tracked automatically in {CurrentContext}. When the current context

is initialized, the system context gets added automatically.

Attributes

hostname[R]
pid[R]

Public Class Methods

new(attributes) click to toggle source
# File lib/logtail/contexts/system.rb, line 13
def initialize(attributes)
  @hostname = attributes[:hostname]
  @pid = attributes[:pid]
end

Public Instance Methods

to_hash() click to toggle source

Builds a hash representation containing simple objects, suitable for serialization (JSON).

# File lib/logtail/contexts/system.rb, line 19
def to_hash
  @to_hash ||= {
    system: Util::NonNilHashBuilder.build do |h|
      h.add(:hostname, hostname)
      h.add(:pid, pid)
    end
  }
end