Class: Timber::Config
- Inherits:
-
Object
- Object
- Timber::Config
- Includes:
- Singleton
- Defined in:
- lib/timber/config.rb
Overview
Interface for settings and reading Timber configuration.
You can override any configuration supplied here by simply setting it:
# Rails
config.timber.api_key = "my api key"
# Everything else
Timber::Config.instance.api_key = "my api key"
If a value is not explicity set, the environment is checked for it's associated environment variable. If that is not set, a reasonable default will be chosen. Each method documents this.
Defined Under Namespace
Classes: NoLoggerError
Instance Attribute Summary collapse
-
#debug_logger ⇒ Object
Set a debug_logger to view internal Timber library log message.
-
#http_body_limit ⇒ Object
Truncates captured HTTP bodies to this specified limit.
-
#logger ⇒ Object
This is the logger Timber writes to.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
24 25 26 |
# File 'lib/timber/config.rb', line 24 def initialize @http_body_limit = 2000 end |
Instance Attribute Details
#debug_logger ⇒ Object
Set a debug_logger to view internal Timber library log message.
Useful for debugging. Defaults to nil. If set, debug messages will be
written to this logger.
32 33 34 |
# File 'lib/timber/config.rb', line 32 def debug_logger @debug_logger end |
#http_body_limit ⇒ Object
Truncates captured HTTP bodies to this specified limit. The default is 2000.
If you want to capture more data, you can raise this to a maximum of 5000,
or lower this to be more efficient with data.
39 40 41 |
# File 'lib/timber/config.rb', line 39 def http_body_limit @http_body_limit end |
#logger ⇒ Object
This is the logger Timber writes to. It should be set to your global
logger to keep the logging destination consitent. Please see delegate_logger_to
to delegate this call to another method. This is set to Rails.logger
for rails.
47 48 49 |
# File 'lib/timber/config.rb', line 47 def logger @logger || raise(NoLoggerError.new) end |