Class: RightScraper::ScraperLogger
- Defined in:
- lib/right_scraper/scraper_logger.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
Returns the value of attribute callback.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Attributes inherited from Logger
Instance Method Summary collapse
- #add(severity, message = nil, progname = nil) ⇒ Object
-
#initialize ⇒ ScraperLogger
constructor
A new instance of ScraperLogger.
- #note_error(exception, type, explanation = "") ⇒ Object
- #note_phase(phase, type, explanation, exception = nil) ⇒ Object
- #note_warning(message) ⇒ Object
Methods inherited from Logger
Constructor Details
#initialize ⇒ ScraperLogger
Returns a new instance of ScraperLogger.
46 47 48 49 |
# File 'lib/right_scraper/scraper_logger.rb', line 46 def initialize @errors = [] @warnings = [] end |
Instance Attribute Details
#callback ⇒ Object
Returns the value of attribute callback.
27 28 29 |
# File 'lib/right_scraper/scraper_logger.rb', line 27 def callback @callback end |
#errors ⇒ Object
Returns the value of attribute errors.
27 28 29 |
# File 'lib/right_scraper/scraper_logger.rb', line 27 def errors @errors end |
#warnings ⇒ Object
Returns the value of attribute warnings.
27 28 29 |
# File 'lib/right_scraper/scraper_logger.rb', line 27 def warnings @warnings end |
Instance Method Details
#add(severity, message = nil, progname = nil) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/right_scraper/scraper_logger.rb', line 29 def add(severity, =nil, progname=nil) if severity >= (self.level || Logger::WARN) if .nil? if block_given? = yield else = progname progname = self.progname end end @errors << [nil, :log, {:severity => severity, :message => , :progname => progname}] end end |
#note_error(exception, type, explanation = "") ⇒ Object
56 57 58 |
# File 'lib/right_scraper/scraper_logger.rb', line 56 def note_error(exception, type, explanation="") @errors << [exception, type, explanation] end |
#note_phase(phase, type, explanation, exception = nil) ⇒ Object
51 52 53 54 |
# File 'lib/right_scraper/scraper_logger.rb', line 51 def note_phase(phase, type, explanation, exception=nil) @callback.call(phase, type, explanation, exception) unless @callback.nil? super end |
#note_warning(message) ⇒ Object
60 61 62 |
# File 'lib/right_scraper/scraper_logger.rb', line 60 def note_warning() @warnings << end |