debug_logging 1.0.10 → 1.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf0324399cfcc272fe33a1a1d932e11e69878e2b
4
- data.tar.gz: 6e4be436b2b21dc916f879dcbd8164da35b6558a
3
+ metadata.gz: 6ea3afaf91b55426d0c4f6674c0515a261dfa77e
4
+ data.tar.gz: 537a3865676eda1263d32ed4a63b08644724cca6
5
5
  SHA512:
6
- metadata.gz: ea4b6a5ac318705e58c5e1be3c189654605800c8cd3d1bd854e10cfeecee0cadb8237e5ce2072fbd351884d2977eb5638993119ff5e7c02107b4c1561a9490a9
7
- data.tar.gz: aa9552a53534a10b20ca6721dee425879c85467b7476ae5c3b3479cad59baa6bd6a6a3a7be626ff962fd0325b0b997ddbd5fec722a809f530001aa08eb0a44ad
6
+ metadata.gz: 5185c10484ed70e559c6b97671e2b64b4e4d70a65db62f09f9e6af07b4bda6d288887bfd7675d22b9989c5542a36ebee354d0638b48854daf1096d04b3b6fcd6
7
+ data.tar.gz: 500daf82402c0709b67c016f4e03b7d96a605949f9255bdb54269577952b55ff1d691acecc8202a25e1082afe0d0a4bd02438593e3a4d2216606727e686b28e8
data/README.md CHANGED
@@ -17,11 +17,11 @@ Unobtrusive, inheritable-overridable-configurable, drop-in debug logging, that w
17
17
  | license | [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) |
18
18
  | expert support | [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github) |
19
19
  | download rank | [![Total Downloads](https://img.shields.io/gem/rt/debug_logging.svg)](https://rubygems.org/gems/debug_logging) |
20
- | version | [![Gem Version](https://badge.fury.io/rb/debug_logging.png)](http://badge.fury.io/rb/debug_logging) |
21
- | dependencies | [![Dependency Status](https://gemnasium.com/pboling/debug_logging.png)](https://gemnasium.com/pboling/debug_logging) |
22
- | code quality | [![Code Climate](https://codeclimate.com/github/pboling/debug_logging.png)](https://codeclimate.com/github/pboling/debug_logging) |
23
- | continuous integration | [![Build Status](https://secure.travis-ci.org/pboling/debug_logging.png?branch=master)](https://travis-ci.org/pboling/debug_logging) |
24
- | test coverage | [![Coverage Status](https://coveralls.io/repos/pboling/debug_logging/badge.png)](https://coveralls.io/r/pboling/debug_logging) |
20
+ | version | [![Gem Version](https://badge.fury.io/rb/debug_logging.svg)](http://badge.fury.io/rb/debug_logging) |
21
+ | dependencies | [![Dependency Status](https://gemnasium.com/pboling/debug_logging.svg)](https://gemnasium.com/pboling/debug_logging) |
22
+ | code quality | [![Code Climate](https://codeclimate.com/github/pboling/debug_logging.svg)](https://codeclimate.com/github/pboling/debug_logging) |
23
+ | continuous integration | [![Build Status](https://secure.travis-ci.org/pboling/debug_logging.svg?branch=master)](https://travis-ci.org/pboling/debug_logging) |
24
+ | test coverage | [![Coverage Status](https://coveralls.io/repos/pboling/debug_logging/badge.svg)](https://coveralls.io/r/pboling/debug_logging) |
25
25
  | homepage | [https://github.com/pboling/debug_logging][homepage] |
26
26
  | documentation | [http://rdoc.info/github/pboling/debug_logging/frames][documentation] |
27
27
  | live chat | [![Join the chat at https://gitter.im/pboling/debug_logging](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/pboling/debug_logging?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) |
@@ -13,12 +13,19 @@ module DebugLogging
13
13
  original_method = method(method_to_log)
14
14
  (class << self; self; end).class_eval do
15
15
  define_method(method_to_log) do |*args, &block|
16
- config_proxy = if opts
17
- Configuration.new(**(debug_config.to_hash.merge(opts)))
16
+ config_proxy = if (proxy = instance_variable_get("@debug_config_proxy_for_k_#{method_to_log}".to_sym))
17
+ proxy
18
18
  else
19
- self
19
+ proxy = if opts
20
+ Configuration.new(**(debug_config.to_hash.merge(opts)))
21
+ else
22
+ self
23
+ end
24
+ instance_variable_set("@debug_config_proxy_for_k_#{method_to_log}".to_sym, proxy)
25
+ proxy
20
26
  end
21
27
  method_return_value = nil
28
+ # TODO: Put all the logic into a logger block, so it will never be computed at runtime if the log level is too high
22
29
  log_prefix = debug_invocation_to_s(klass: self.to_s, separator: ".", method_to_log: method_to_log, config_proxy: config_proxy)
23
30
  signature = debug_signature_to_s(args: args, config_proxy: config_proxy)
24
31
  invocation_id = debug_invocation_id_to_s(args: args, config_proxy: config_proxy)
@@ -4,13 +4,21 @@ module DebugLogging
4
4
  Module.new do
5
5
  Array(methods_to_log).each do |method_to_log|
6
6
  # method name must be a symbol
7
+
7
8
  define_method(method_to_log.to_sym) do |*args, &block|
8
- config_proxy = if config
9
- Configuration.new(**(self.class.debug_config.to_hash.merge(config)))
9
+ method_return_value = nil
10
+ config_proxy = if (proxy = instance_variable_get("@debug_config_proxy_for_#{method_to_log}".to_sym))
11
+ proxy
10
12
  else
11
- self.class
13
+ proxy = if config
14
+ Configuration.new(**(self.class.debug_config.to_hash.merge(config)))
15
+ else
16
+ self.class
17
+ end
18
+ instance_variable_set("@debug_config_proxy_for_#{method_to_log}".to_sym, proxy)
19
+ proxy
12
20
  end
13
- method_return_value = nil
21
+ # TODO: Put all the logic into a logger block, so it will never be computed at runtime if the log level is too high
14
22
  log_prefix = self.class.debug_invocation_to_s(klass: self.class.to_s, separator: "#", method_to_log: method_to_log, config_proxy: config_proxy)
15
23
  signature = self.class.debug_signature_to_s(args: args, config_proxy: config_proxy)
16
24
  invocation_id = self.class.debug_invocation_id_to_s(args: args, config_proxy: config_proxy)
@@ -1,3 +1,3 @@
1
1
  module DebugLogging
2
- VERSION = "1.0.10"
2
+ VERSION = "1.0.11"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  # Simpler version of what the sibling DebugLogging library does. Included as a bauble.
2
2
  #
3
3
  ############# THIS IS A BAUBLE
4
- ############# FOR EXAMINGING SEVERAL OF THE WONDERS OF RUBY
4
+ ############# FOR EXAMINING SEVERAL OF THE WONDERS OF RUBY
5
5
  ############# TO ACCOMPLISH SOMETHING PRACTICAL
6
6
  ############# For a more robust implementation use the gem debug_logging itself,
7
7
  ############# which makes use of these same principles.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: debug_logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.10
4
+ version: 1.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-26 00:00:00.000000000 Z
11
+ date: 2017-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize