module SitePrism
SitePrism
-
namespace
We autoload our files underneath here to provide a slightly more optimal load solution
Constants
- VERSION
Attributes
Public Class Methods
# File lib/site_prism.rb, line 25 def configure yield self end
To query what level is being logged
SitePrism.log_level => :UNKNOWN # By default
# File lib/site_prism.rb, line 72 def log_level %i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level] end
To enable full logging (This uses the Ruby API, so can accept any of a Symbol / String / Integer as an input
SitePrism.log_level = :DEBUG SitePrism.log_level = 'DEBUG' SitePrism.log_level = 0
To disable all logging (Done by default)
SitePrism.log_level = :UNKNOWN
# File lib/site_prism.rb, line 65 def log_level=(value) logger.level = value end
`Logger#reopen` was added in Ruby 2.3 - Which is now the minimum version for the site_prism gem
This writer method allows you to configure where you want the output of the site_prism logs to go (Default is $stdout)
example: SitePrism.log_path = 'site_prism.log' would save all log messages to `./site_prism.log`
# File lib/site_prism.rb, line 53 def log_path=(logdev) logger.reopen(logdev) end
The SitePrism
logger object - This is called automatically in several locations and will log messages according to the normal Ruby protocol To alter (or check), the log level; call .log_level= or .log_level
This logger object can also be used to manually log messages
To Manually log a message
SitePrism.logger.info('Information') SitePrism.logger.debug('Input debug message')
By default the logger will output all messages to $stdout, but can be altered to log to a file or another IO location by calling `.log_path=`
# File lib/site_prism.rb, line 41 def logger @logger ||= SitePrism::Logger.new.create end
Whether you wish to use the new experimental all_there dependent gem
This will be enforced from site_prism v4 onwards as this is where the development of this functionality will be focused
# File lib/site_prism.rb, line 79 def use_all_there_gem=(value) logger.debug("Setting use_all_there_gem to #{value}") @use_all_there_gem = value end