Module: SitePrism

Defined in:
lib/site_prism.rb,
lib/site_prism/dsl.rb,
lib/site_prism/page.rb,
lib/site_prism/error.rb,
lib/site_prism/logger.rb,
lib/site_prism/waiter.rb,
lib/site_prism/section.rb,
lib/site_prism/version.rb,
lib/site_prism/loadable.rb,
lib/site_prism/deprecator.rb,
lib/site_prism/element_checker.rb,
lib/site_prism/recursion_checker.rb,
lib/site_prism/addressable_url_matcher.rb

Defined Under Namespace

Modules: DSL, ElementChecker, Loadable Classes: AddressableUrlMatcher, BlockError, Deprecator, ElementInvisibilityTimeoutError, ElementVisibilityTimeoutError, FailedLoadValidationError, FrozenInTimeError, InvalidElementError, InvalidUrlMatcherError, Logger, MissingBlockError, NoUrlForPageError, NoUrlMatcherForPageError, Page, PageLoadError, RecursionChecker, Section, SitePrismError, TimeoutError, UnsupportedBlockError, Waiter

Constant Summary collapse

VERSION =
'3.4.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.use_all_there_gemObject

Returns the value of attribute use_all_there_gem


18
19
20
# File 'lib/site_prism.rb', line 18

def use_all_there_gem
  @use_all_there_gem
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (SitePrism)

    the object that the method was called on


20
21
22
# File 'lib/site_prism.rb', line 20

def configure
  yield self
end

.log_levelObject

To query what level is being logged

SitePrism.log_level
=> :UNKNOWN # By default

67
68
69
# File 'lib/site_prism.rb', line 67

def log_level
  i[DEBUG INFO WARN ERROR FATAL UNKNOWN][logger.level]
end

.log_level=(value) ⇒ Object

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

60
61
62
# File 'lib/site_prism.rb', line 60

def log_level=(value)
  logger.level = value
end

.log_path=(logdev) ⇒ Object

`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`


48
49
50
# File 'lib/site_prism.rb', line 48

def log_path=(logdev)
  logger.reopen(logdev)
end

.loggerObject

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=`


36
37
38
# File 'lib/site_prism.rb', line 36

def logger
  @logger ||= SitePrism::Logger.new.create
end