Sha256: d8b3629bfd06205a5089cf35754640732dfb88fa0cacf8046301536786fcf20b
Contents?: true
Size: 1.09 KB
Versions: 3
Compression:
Stored size: 1.09 KB
Contents
require "timber/context" module Timber module Contexts # 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 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 # Builds a hash representation containing simple objects, suitable for serialization (JSON). def as_json(_options = {}) {application: application, class_name: class_name, file: file, function: function, line: line, module_name: module_name} end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
timber-2.1.1 | lib/timber/contexts/runtime.rb |
timber-2.1.0 | lib/timber/contexts/runtime.rb |
timber-2.1.0.rc6 | lib/timber/contexts/runtime.rb |