Skip to content
This repository has been archived by the owner on Dec 8, 2020. It is now read-only.

Commit

Permalink
Add contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
binarylogic committed Feb 10, 2017
1 parent 5a15ff7 commit 740c31d
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 2 deletions.
2 changes: 2 additions & 0 deletions 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"

Expand Down
18 changes: 18 additions & 0 deletions 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
1 change: 0 additions & 1 deletion lib/timber/contexts/process.rb

This file was deleted.

25 changes: 24 additions & 1 deletion lib/timber/contexts/runtime.rb
@@ -1 +1,24 @@
runtime.rb
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

0 comments on commit 740c31d

Please sign in to comment.