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
# File 'lib/timber/contexts/system.rb', line 9

def initialize(attributes)
  @pid = attributes[:pid] || raise(ArgumentError.new(":pid is required"))
  @pid = @pid.to_s
end

Instance Attribute Details

#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



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

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