rails_semantic_logger 4.3.3 → 4.3.4

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
  SHA256:
3
- metadata.gz: 6b2cc51eea0d6fbabd25c7910b9f45b4f4235bbcbc8fba66f550e196c6f548d3
4
- data.tar.gz: cbb086a85a4102487dd289ec4ef9f538888b1c378796e26ba9b0952f026e7a04
3
+ metadata.gz: 383f5c56b230f3b1382a9ffe66ed8ab07df5265c5689811f504aeb0624558c1f
4
+ data.tar.gz: cc19e5cb92ac8b1400c6e41c8767cb781b04cc6f5499d52e24774a93ff11027b
5
5
  SHA512:
6
- metadata.gz: 78fcebe2e9dda1b09c2c0f2685dbc05b5133c7e25eba1bf8d1a03b65057ed8f86a49f579bd3dfa31bf8a96dcc3060a73ba863679c5f5298acf4866efdef6407c
7
- data.tar.gz: 689203b5e6b4402fafe15caacb996720cbbcce95f359f3a3c5b1fc00f78f923229f7ebab5c14b0cdc0f618b9390b2a3ccdfef3cc340f82b03e4ed2b8b9df1bbb
6
+ metadata.gz: d2e48add790447a763d6e75b0476fa0ae955f9a85c25db4df2f5289c396804b9fb6a6394d863324e8a80131ea130d07c96394c8e29b11d2149780f970cc7cf61
7
+ data.tar.gz: 4df21eda6b31e0b50827f8d68e8b602d7d140c6e6d584c42682c90cb46a88b8e3235dc3016658a4f9894b65c848c92dec40fbd10c1c95bffbd34f886b446223b
@@ -16,9 +16,11 @@ module RailsSemanticLogger
16
16
  autoload :Logger, 'rails_semantic_logger/rack/logger'
17
17
  end
18
18
  module DelayedJob
19
- autoload :Plugin, 'rails_semantic_logger/delayed_job/plugin.rb'
19
+ autoload :Plugin, 'rails_semantic_logger/delayed_job/plugin'
20
20
  end
21
21
 
22
+ autoload :Options, 'rails_semantic_logger/options'
23
+
22
24
  # Swap an existing subscriber with a new one
23
25
  def self.swap_subscriber(old_class, new_class, notifier)
24
26
  subscribers = ActiveSupport::LogSubscriber.subscribers.select { |s| s.is_a?(old_class) }
@@ -1,4 +1,5 @@
1
1
  require 'action_controller/log_subscriber'
2
+ require 'rails_semantic_logger/options'
2
3
 
3
4
  module RailsSemanticLogger
4
5
  class Engine < ::Rails::Engine
@@ -18,92 +19,7 @@ module RailsSemanticLogger
18
19
  # end
19
20
  config.semantic_logger = ::SemanticLogger
20
21
 
21
- config.rails_semantic_logger = ActiveSupport::OrderedOptions.new
22
-
23
- # Convert Action Controller and Active Record text messages to semantic data
24
- # Rails -- Started -- { :ip => "127.0.0.1", :method => "GET", :path => "/dashboards/inquiry_recent_activity" }
25
- # UserController -- Completed #index -- { :action => "index", :db_runtime => 54.64, :format => "HTML", :method => "GET", :mongo_runtime => 0.0, :path => "/users", :status => 200, :status_message => "OK", :view_runtime => 709.88 }
26
- config.rails_semantic_logger.semantic = true
27
-
28
- # Change Rack started message to debug so that it does not appear in production
29
- config.rails_semantic_logger.started = false
30
-
31
- # Change Processing message to debug so that it does not appear in production
32
- config.rails_semantic_logger.processing = false
33
-
34
- # Change Action View render log messages to debug so that they do not appear in production
35
- # ActionView::Base -- Rendered data/search/_user.html.haml (46.7ms)
36
- config.rails_semantic_logger.rendered = false
37
-
38
- # Override the Awesome Print options for logging Hash data as text:
39
- #
40
- # Any valid AwesomePrint option for rendering data.
41
- # The defaults can changed be creating a `~/.aprc` file.
42
- # See: https://github.com/michaeldv/awesome_print
43
- #
44
- # Note: The option :multiline is set to false if not supplied.
45
- # Note: Has no effect if Awesome Print is not installed.
46
- config.rails_semantic_logger.ap_options = {multiline: false}
47
-
48
- # Whether to automatically add an environment specific log file appender.
49
- # For Example: 'log/development.log'
50
- #
51
- # Note:
52
- # When Semantic Logger fails to log to an appender it logs the error to an
53
- # internal logger, which by default writes to STDERR.
54
- # Example, change the default internal logger to log to stdout:
55
- # SemanticLogger::Processor.logger = SemanticLogger::Appender::File.new(io: STDOUT, level: :warn)
56
- config.rails_semantic_logger.add_file_appender = true
57
-
58
- # Silence asset logging
59
- config.rails_semantic_logger.quiet_assets = false
60
-
61
- # Override the output format for the primary Rails log file.
62
- #
63
- # Valid options:
64
- # * :default
65
- # Plain text output with no color.
66
- # * :color
67
- # Plain text output with color.
68
- # * :json
69
- # JSON output format.
70
- # * class
71
- #
72
- # * Proc
73
- # A block that will be called to format the output.
74
- # It is supplied with the `log` entry and should return the formatted data.
75
- #
76
- # Note:
77
- # * `:default` is automatically changed to `:color` if `config.colorize_logging` is `true`.
78
- #
79
- # JSON Example, in `application.rb`:
80
- #
81
- # config.rails_semantic_logger.format = :json
82
- #
83
- # Custom Example, create `app/lib/my_formatter.rb`:
84
- #
85
- # # My Custom colorized formatter
86
- # class MyFormatter < SemanticLogger::Formatters::Color
87
- # # Return the complete log level name in uppercase
88
- # def level
89
- # "#{color}log.level.upcase#{color_map.clear}"
90
- # end
91
- # end
92
- #
93
- # # In application.rb:
94
- # config.rails_semantic_logger.format = MyFormatter.new
95
- config.rails_semantic_logger.format = :default
96
-
97
- # DEPRECATED
98
- # Instead, supply a Hash to config.log_tags
99
- config.rails_semantic_logger.named_tags = nil
100
-
101
- # Add a filter to the file logger [Regexp|Proc]
102
- # RegExp: Only include log messages where the class name matches the supplied
103
- # regular expression. All other messages will be ignored.
104
- # Proc: Only include log messages where the supplied Proc returns true.
105
- # The Proc must return true or false.
106
- config.rails_semantic_logger.filter = nil
22
+ config.rails_semantic_logger = RailsSemanticLogger::Options.new
107
23
 
108
24
  # Initialize SemanticLogger. In a Rails environment it will automatically
109
25
  # insert itself above the configured rails logger to add support for its
@@ -0,0 +1,117 @@
1
+ module RailsSemanticLogger
2
+ # Options for controlling Rails Semantic Logger behavior
3
+ #
4
+ # * Convert Action Controller and Active Record text messages to semantic data
5
+ #
6
+ # Rails -- Started -- { :ip => "127.0.0.1", :method => "GET", :path => "/dashboards/inquiry_recent_activity" }
7
+ # UserController -- Completed #index -- { :action => "index", :db_runtime => 54.64, :format => "HTML", :method => "GET", :mongo_runtime => 0.0, :path => "/users", :status => 200, :status_message => "OK", :view_runtime => 709.88 }
8
+ #
9
+ # config.rails_semantic_logger.semantic = true
10
+ #
11
+ # * Change Rack started message to debug so that it does not appear in production
12
+ #
13
+ # config.rails_semantic_logger.started = false
14
+ #
15
+ # * Change Processing message to debug so that it does not appear in production
16
+ #
17
+ # config.rails_semantic_logger.processing = false
18
+ #
19
+ # * Change Action View render log messages to debug so that they do not appear in production
20
+ #
21
+ # ActionView::Base -- Rendered data/search/_user.html.haml (46.7ms)
22
+ #
23
+ # config.rails_semantic_logger.rendered = false
24
+ #
25
+ # * Override the Awesome Print options for logging Hash data as text:
26
+ #
27
+ # Any valid AwesomePrint option for rendering data.
28
+ # The defaults can changed be creating a `~/.aprc` file.
29
+ # See: https://github.com/michaeldv/awesome_print
30
+ #
31
+ # Note: The option :multiline is set to false if not supplied.
32
+ # Note: Has no effect if Awesome Print is not installed.
33
+ #
34
+ # config.rails_semantic_logger.ap_options = {multiline: false}
35
+ #
36
+ # * Whether to automatically add an environment specific log file appender.
37
+ # For Example: 'log/development.log'
38
+ #
39
+ # Note:
40
+ # When Semantic Logger fails to log to an appender it logs the error to an
41
+ # internal logger, which by default writes to STDERR.
42
+ # Example, change the default internal logger to log to stdout:
43
+ # SemanticLogger::Processor.logger = SemanticLogger::Appender::File.new(io: STDOUT, level: :warn)
44
+ #
45
+ # config.rails_semantic_logger.add_file_appender = true
46
+ #
47
+ # * Silence asset logging
48
+ #
49
+ # config.rails_semantic_logger.quiet_assets = false
50
+ #
51
+ # * Override the output format for the primary Rails log file.
52
+ #
53
+ # Valid options:
54
+ # * :default
55
+ # Plain text output with no color.
56
+ # * :color
57
+ # Plain text output with color.
58
+ # * :json
59
+ # JSON output format.
60
+ # * class
61
+ #
62
+ # * Proc
63
+ # A block that will be called to format the output.
64
+ # It is supplied with the `log` entry and should return the formatted data.
65
+ #
66
+ # Note:
67
+ # * `:default` is automatically changed to `:color` if `config.colorize_logging` is `true`.
68
+ #
69
+ # JSON Example, in `application.rb`:
70
+ # config.rails_semantic_logger.format = :json
71
+ #
72
+ # Custom Example, create `app/lib/my_formatter.rb`:
73
+ #
74
+ # # My Custom colorized formatter
75
+ # class MyFormatter < SemanticLogger::Formatters::Color
76
+ # # Return the complete log level name in uppercase
77
+ # def level
78
+ # "#{color}log.level.upcase#{color_map.clear}"
79
+ # end
80
+ # end
81
+ #
82
+ # # In application.rb:
83
+ # config.rails_semantic_logger.format = MyFormatter.new
84
+ #
85
+ #
86
+ # config.rails_semantic_logger.format = :default
87
+ #
88
+ # * Add a filter to the file logger [Regexp|Proc]
89
+ # RegExp: Only include log messages where the class name matches the supplied
90
+ # regular expression. All other messages will be ignored.
91
+ # Proc: Only include log messages where the supplied Proc returns true.
92
+ # The Proc must return true or false.
93
+ #
94
+ # config.rails_semantic_logger.filter = nil
95
+ #
96
+ # * named_tags: *DEPRECATED*
97
+ # Instead, supply a Hash to config.log_tags
98
+ # config.rails_semantic_logger.named_tags = nil
99
+ class Options
100
+ attr_accessor :semantic, :started, :processing, :rendered, :ap_options, :add_file_appender,
101
+ :quiet_assets, :format, :named_tags, :filter
102
+
103
+ # Setup default values
104
+ def initialize
105
+ @semantic = true
106
+ @started = false
107
+ @processing = false
108
+ @rendered = false
109
+ @ap_options = {multiline: false}
110
+ @add_file_appender = true
111
+ @quiet_assets = false
112
+ @format = :default
113
+ @named_tags = nil
114
+ @filter = nil
115
+ end
116
+ end
117
+ end
@@ -1,3 +1,3 @@
1
1
  module RailsSemanticLogger
2
- VERSION = '4.3.3'.freeze
2
+ VERSION = '4.3.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_semantic_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.3
4
+ version: 4.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Reid Morrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-18 00:00:00.000000000 Z
11
+ date: 2019-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -61,6 +61,7 @@ files:
61
61
  - lib/rails_semantic_logger/extensions/active_job/logging.rb
62
62
  - lib/rails_semantic_logger/extensions/active_model_serializers/logging.rb
63
63
  - lib/rails_semantic_logger/extensions/rails/server.rb
64
+ - lib/rails_semantic_logger/options.rb
64
65
  - lib/rails_semantic_logger/rack/logger.rb
65
66
  - lib/rails_semantic_logger/version.rb
66
67
  homepage: https://github.com/rocketjob/rails_semantic_logger
@@ -82,8 +83,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
83
  - !ruby/object:Gem::Version
83
84
  version: '0'
84
85
  requirements: []
85
- rubyforge_project:
86
- rubygems_version: 2.7.7
86
+ rubygems_version: 3.0.2
87
87
  signing_key:
88
88
  specification_version: 4
89
89
  summary: Feature rich logging framework that replaces the Rails logger.