paul_bunyan 1.0.0 → 1.0.1

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: 0c8be4508c3bf748cc21adad0846a24d822dbea2
4
- data.tar.gz: bee128e2be543d84c4ae31571949385c53c74a6f
3
+ metadata.gz: 956ccef06d46e5dfffa5d275b380f268a6de7bd2
4
+ data.tar.gz: 2c69762bb62009f0a60284b007853ffd724db02b
5
5
  SHA512:
6
- metadata.gz: 49db1d3690ffdf9756b57200227e1ddb797dd867064fb3c4f63e6264e1babd8737473986abd01497a02a22b962ad17bcbfe4a4ad91ec7431c499307304c8363d
7
- data.tar.gz: a41bb6c373d12cc1a4d68e0c38524aa5bea49a6e8adc175f439fdd17c7dcf9f53e46c39f03a8a7b279702b8c9c08efa7f72a103e79975cbcb7b9fb997c6936be
6
+ metadata.gz: b8ee48f85b919d37e8d9381f6b078204f51d8ee73e6202727e5e6ac22f8789a3597c17ba86b6749aa014e8516fe7e2078caf23ff4070f88088c52a0cf0ad7dfa
7
+ data.tar.gz: 4227bdd9d9f14e611a32a5f6cfdeda41324115c8bbe289e9b17dfa1c3117b475156d8d8e59c40fbb3af78f8d53faaf17503f59c7aaf55dba1f996d7b0ce01ebd
@@ -0,0 +1,11 @@
1
+ require 'active_support/logger'
2
+
3
+ # Sad hax but ActiveRecord insists on using this method for console sessions
4
+ # and everything uses it in development causing us to get double log lines :-(
5
+ module ActiveSupport
6
+ class Logger
7
+ def self.broadcast(_)
8
+ Module.new
9
+ end
10
+ end
11
+ end
@@ -5,3 +5,4 @@ end
5
5
 
6
6
  require 'paul_bunyan/rails_ext/rack_logger'
7
7
  require 'paul_bunyan/rails_ext/instrumentation'
8
+ require 'paul_bunyan/rails_ext/active_support_logger'
@@ -39,6 +39,10 @@ module PaulBunyan
39
39
  Rails.logger = PaulBunyan.logger
40
40
  end
41
41
 
42
+ console do
43
+ PaulBunyan.logger.formatter = TextFormatter.new(include_metadata: false)
44
+ end
45
+
42
46
  def conditionally_unsubscribe(listener)
43
47
  delegate = listener.instance_variable_get(:@delegate)
44
48
  ActiveSupport::Notifications.unsubscribe(listener) if DEFAULT_LOGGERS.include?(delegate.class)
@@ -1,10 +1,22 @@
1
+ begin
2
+ require 'active_support/tagged_logging'
3
+ rescue LoadError
4
+ end
5
+
1
6
  module PaulBunyan
2
7
  class TextFormatter < Logger::Formatter
8
+ include ActiveSupport::TaggedLogging::Formatter if defined?(ActiveSupport::TaggedLogging)
9
+
10
+ def initialize(include_metadata: true)
11
+ @include_metadata = include_metadata
12
+ end
13
+
3
14
  def call(severity, time, progname, msg)
4
- if msg.is_a?(Hash)
5
- super(severity, time, progname, msg[:message])
15
+ message = (String === msg ? msg : msg.inspect)
16
+ if @include_metadata
17
+ super(severity, time, progname, message)
6
18
  else
7
- super(severity, time, progname, msg)
19
+ message + "\n"
8
20
  end
9
21
  end
10
22
  end
@@ -1,3 +1,3 @@
1
1
  module PaulBunyan
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paul_bunyan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duane Johnson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-08-28 00:00:00.000000000 Z
14
+ date: 2015-09-09 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: request_store
@@ -155,6 +155,7 @@ files:
155
155
  - lib/paul_bunyan/level.rb
156
156
  - lib/paul_bunyan/log_relayer.rb
157
157
  - lib/paul_bunyan/rails_ext.rb
158
+ - lib/paul_bunyan/rails_ext/active_support_logger.rb
158
159
  - lib/paul_bunyan/rails_ext/instrumentation.rb
159
160
  - lib/paul_bunyan/rails_ext/rack_logger.rb
160
161
  - lib/paul_bunyan/railtie.rb