lib/timber/contexts/system.rb in timber-2.0.24 vs lib/timber/contexts/system.rb in timber-2.1.0.rc1
- old
+ new
@@ -1,8 +1,11 @@
+require "timber/context"
+require "timber/util"
+
module Timber
module Contexts
- # Tracks OS level process information, such as the process ID.
+ # The system context tracks OS level process information, such as the process ID.
class System < Context
@keyspace = :system
attr_reader :hostname, :pid
@@ -10,9 +13,10 @@
@hostname = attributes[:hostname]
@pid = attributes[:pid]
@pid = @pid.to_s
end
+ # Builds a hash representation of containing simply objects, suitable for serialization.
def as_json(_options = {})
{hostname: hostname, pid: Timber::Util::Object.try(pid, :to_s)}
end
end
end
\ No newline at end of file