Module: Skylight::Util::Logging Private
- Included in:
- GC, Instrumenter, Middleware, Probes::Excon::Middleware, Subscriber, Trace, HTTP
- Defined in:
- lib/skylight/util/logging.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .trace? ⇒ Boolean private
Instance Method Summary collapse
- #debug(msg, *args) ⇒ Object (also: #log_debug) private
- #error(msg, *args) ⇒ Object (also: #log_error) private
- #info(msg, *args) ⇒ Object (also: #log_info) private
- #log(level, msg, *args) ⇒ Object private
- #t ⇒ Object private
- #trace ⇒ Object (also: #log_trace) private
- #warn(msg, *args) ⇒ Object (also: #log_warn) private
Class Method Details
.trace? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 |
# File 'lib/skylight/util/logging.rb', line 21 def self.trace? ENV[TRACE_ENV_KEY] end |
Instance Method Details
#debug(msg, *args) ⇒ Object Also known as: log_debug
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 |
# File 'lib/skylight/util/logging.rb', line 41 def debug(msg, *args) log :debug, msg, *args end |
#error(msg, *args) ⇒ Object Also known as: log_error
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/skylight/util/logging.rb', line 53 def error(msg, *args) log :error, msg, *args end |
#info(msg, *args) ⇒ Object Also known as: log_info
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/skylight/util/logging.rb', line 45 def info(msg, *args) log :info, msg, *args end |
#log(level, msg, *args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/skylight/util/logging.rb', line 65 def log(level, msg, *args) return unless respond_to?(:config) return unless c = config if logger = c.logger return unless logger.respond_to?(level) if args.length > 0 logger.send level, sprintf("[SKYLIGHT] [#{Skylight::VERSION}] #{msg}", *args) else logger.send level, "[SKYLIGHT] [#{Skylight::VERSION}] #{msg}" end end rescue Exception => e if ENV[TRACE_ENV_KEY] puts "[ERROR] #{e.}" puts e.backtrace end end |
#t ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
30 31 32 |
# File 'lib/skylight/util/logging.rb', line 30 def t log :debug, yield end |
#trace ⇒ Object Also known as: log_trace
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/skylight/util/logging.rb', line 26 def trace(msg, *args) log :debug, msg, *args end |
#warn(msg, *args) ⇒ Object Also known as: log_warn
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 |
# File 'lib/skylight/util/logging.rb', line 49 def warn(msg, *args) log :warn, msg, *args end |