Class: Timber::Contexts::System

Inherits:
Timber::Context
  • Object
show all
Defined in:
lib/timber/contexts/system.rb

Overview

Tracks OS level process information, such as the process ID.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ System

Returns a new instance of System.



9
10
11
12
13
# File 'lib/timber/contexts/system.rb', line 9

def initialize(attributes)
  @hostname = attributes[:hostname]
  @pid = attributes[:pid]
  @pid = @pid.to_s
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname.



7
8
9
# File 'lib/timber/contexts/system.rb', line 7

def hostname
  @hostname
end

#pidObject (readonly)

Returns the value of attribute pid.



7
8
9
# File 'lib/timber/contexts/system.rb', line 7

def pid
  @pid
end

Instance Method Details

#as_json(_options = {}) ⇒ Object



15
16
17
# File 'lib/timber/contexts/system.rb', line 15

def as_json(_options = {})
  {hostname: hostname, pid: Timber::Util::Object.try(pid, :to_s)}
end