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/timer.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/dsl/builder.rb,
lib/site_prism/dsl/methods.rb,
lib/site_prism/dsl/locators.rb,
lib/site_prism/dsl/validator.rb,
lib/site_prism/rspec_matchers.rb,
lib/site_prism/element_checker.rb,
lib/site_prism/addressable_url_matcher.rb

Overview

SitePrism

Defined Under Namespace

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

Constant Summary collapse

VERSION =
'5.0.beta'

Class Method Summary collapse

Class Method Details

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

Yields:

  • (_self)

Yield Parameters:

  • _self (SitePrism)

    the object that the method was called on



25
26
27
# File 'lib/site_prism.rb', line 25

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


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

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

.log_path=(logdev) ⇒ Object

Configure where you want the output of the site_prism logs to go (Default is $stdout)

To save all logs to a specific output file

SitePrism.log_path = 'site_prism.log'


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

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



41
42
43
# File 'lib/site_prism.rb', line 41

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