Class: RailsSemanticLogger::Options
- Inherits:
-
Object
- Object
- RailsSemanticLogger::Options
- Defined in:
- lib/rails_semantic_logger/options.rb
Overview
Options for controlling Rails Semantic Logger behavior
-
Convert Action Controller and Active Record text messages to semantic data
Rails -- Started -- { :ip => "127.0.0.1", :method => "GET", :path => "/dashboards/inquiry_recent_activity" } 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 } config.rails_semantic_logger.semantic = true
-
Change Rack started message to debug so that it does not appear in production
config.rails_semantic_logger.started = false
-
Change Processing message to debug so that it does not appear in production
config.rails_semantic_logger.processing = false
-
Change Action View render log messages to debug so that they do not appear in production
ActionView::Base -- Rendered data/search/_user.html.haml (46.7ms) config.rails_semantic_logger.rendered = false
-
Override the Awesome Print options for logging Hash data as text:
Any valid AwesomePrint option for rendering data. The defaults can changed be creating a `~/.aprc` file. See: https://github.com/michaeldv/awesome_print Note: The option :multiline is set to false if not supplied. Note: Has no effect if Awesome Print is not installed. config.rails_semantic_logger.ap_options = {multiline: false}
-
Whether to automatically add an environment specific log file appender.
For Example: 'log/development.log' Note: When Semantic Logger fails to log to an appender it logs the error to an internal logger, which by default writes to STDERR. Example, change the default internal logger to log to stdout: SemanticLogger::Processor.logger = SemanticLogger::Appender::File.new(io: STDOUT, level: :warn) config.rails_semantic_logger.add_file_appender = true
-
Silence asset logging
config.rails_semantic_logger.quiet_assets = false
-
Override the output format for the primary Rails log file.
Valid options: * :default Plain text output with no color. * :color Plain text output with color. * :json JSON output format. * class * Proc A block that will be called to format the output. It is supplied with the `log` entry and should return the formatted data. Note: * `:default` is automatically changed to `:color` if `config.colorize_logging` is `true`. JSON Example, in `application.rb`: config.rails_semantic_logger.format = :json Custom Example, create `app/lib/my_formatter.rb`: # My Custom colorized formatter class MyFormatter < SemanticLogger::Formatters::Color # Return the complete log level name in uppercase def level "#{color}log.level.upcase#{color_map.clear}" end end # In application.rb: config.rails_semantic_logger.format = MyFormatter.new config.rails_semantic_logger.format = :default
-
Add a filter to the file logger [Regexp|Proc] RegExp: Only include log messages where the class name matches the supplied
regular expression. All other messages will be ignored.
Proc: Only include log messages where the supplied Proc returns true.
The Proc must return true or false. config.rails_semantic_logger.filter = nil
-
named_tags: DEPRECATED Instead, supply a Hash to config.log_tags config.rails_semantic_logger.named_tags = nil
Instance Attribute Summary collapse
-
#add_file_appender ⇒ Object
Returns the value of attribute add_file_appender.
-
#ap_options ⇒ Object
Returns the value of attribute ap_options.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#format ⇒ Object
Returns the value of attribute format.
-
#named_tags ⇒ Object
Returns the value of attribute named_tags.
-
#processing ⇒ Object
Returns the value of attribute processing.
-
#quiet_assets ⇒ Object
Returns the value of attribute quiet_assets.
-
#rendered ⇒ Object
Returns the value of attribute rendered.
-
#semantic ⇒ Object
Returns the value of attribute semantic.
-
#started ⇒ Object
Returns the value of attribute started.
Instance Method Summary collapse
-
#initialize ⇒ Options
constructor
Setup default values.
Constructor Details
#initialize ⇒ Options
Setup default values
104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/rails_semantic_logger/options.rb', line 104 def initialize @semantic = true @started = false @processing = false @rendered = false @ap_options = {multiline: false} @add_file_appender = true @quiet_assets = false @format = :default @named_tags = nil @filter = nil end |
Instance Attribute Details
#add_file_appender ⇒ Object
Returns the value of attribute add_file_appender.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def add_file_appender @add_file_appender end |
#ap_options ⇒ Object
Returns the value of attribute ap_options.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def @ap_options end |
#filter ⇒ Object
Returns the value of attribute filter.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def filter @filter end |
#format ⇒ Object
Returns the value of attribute format.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def format @format end |
#named_tags ⇒ Object
Returns the value of attribute named_tags.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def @named_tags end |
#processing ⇒ Object
Returns the value of attribute processing.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def processing @processing end |
#quiet_assets ⇒ Object
Returns the value of attribute quiet_assets.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def quiet_assets @quiet_assets end |
#rendered ⇒ Object
Returns the value of attribute rendered.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def rendered @rendered end |
#semantic ⇒ Object
Returns the value of attribute semantic.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def semantic @semantic end |
#started ⇒ Object
Returns the value of attribute started.
100 101 102 |
# File 'lib/rails_semantic_logger/options.rb', line 100 def started @started end |