diff --git a/lib/timber/contexts.rb b/lib/timber/contexts.rb index 9080ac91..0c97d466 100644 --- a/lib/timber/contexts.rb +++ b/lib/timber/contexts.rb @@ -1,6 +1,8 @@ require "timber/contexts/custom" require "timber/contexts/http" require "timber/contexts/organization" +require "timber/contexts/os_process" +require "timber/contexts/runtime" require "timber/contexts/tags" require "timber/contexts/user" diff --git a/lib/timber/contexts/os_process.rb b/lib/timber/contexts/os_process.rb new file mode 100644 index 00000000..9558753f --- /dev/null +++ b/lib/timber/contexts/os_process.rb @@ -0,0 +1,18 @@ +module Timber + module Contexts + # Tracks OS level process information, such as the process ID. + class OSProcess < Context + @keyspace = :os_process + + attr_reader :pid + + def initialize(attributes) + @pid = attributes[:pid] + end + + def as_json(_options = {}) + {pid: pid} + end + end + end +end \ No newline at end of file diff --git a/lib/timber/contexts/process.rb b/lib/timber/contexts/process.rb deleted file mode 100644 index cf8db819..00000000 --- a/lib/timber/contexts/process.rb +++ /dev/null @@ -1 +0,0 @@ -process.rb \ No newline at end of file diff --git a/lib/timber/contexts/runtime.rb b/lib/timber/contexts/runtime.rb index c06bf16c..658e216e 100644 --- a/lib/timber/contexts/runtime.rb +++ b/lib/timber/contexts/runtime.rb @@ -1 +1,24 @@ -runtime.rb \ No newline at end of file +module Timber + module Contexts + # Tracks OS level process information, such as the process ID. + class Runtime < Context + @keyspace = :runtime + + attr_reader :application, :class_name, :file, :function, :line, :module_name + + def initialize(attributes) + @application = attributes[:application] + @class_name = attributes[:class_name] + @file = attributes[:file] + @function = attributes[:function] + @line = attributes[:line] + @module_name = attributes[:module_name] + end + + def as_json(_options = {}) + {application: application, class_name: class_name, file: file, function: function, + line: line, module_name: module_name} + end + end + end +end \ No newline at end of file