lib/timber/contexts/runtime.rb in timber-2.0.24 vs lib/timber/contexts/runtime.rb in timber-2.1.0.rc1
- old
+ new
@@ -1,8 +1,13 @@
+require "timber/context"
+
module Timber
module Contexts
- # Tracks OS level process information, such as the process ID.
+ # The runtime context adds current runtime data to your logs, such as the file, line number,
+ # class or module name, etc. This makes it easy to tail and search your logs by their
+ # origin in your code. For example, if you are debugging a specific class, you can narrow
+ # by that class and see only it's logs.
class Runtime < Context
@keyspace = :runtime
attr_reader :application, :class_name, :file, :function, :line, :module_name
@@ -13,9 +18,10 @@
@function = attributes[:function]
@line = attributes[:line]
@module_name = attributes[:module_name]
end
+ # Builds a hash representation of containing simply objects, suitable for serialization.
def as_json(_options = {})
{application: application, class_name: class_name, file: file, function: function,
line: line, module_name: module_name}
end
end
\ No newline at end of file