Class: RightScraper::ScraperLogger
- Inherits:
-
Logger
- Object
- Logger
- Logger
- RightScraper::ScraperLogger
- Defined in:
- lib/right_scraper/scraper_logger.rb
Instance Attribute Summary (collapse)
-
- (Object) callback
Returns the value of attribute callback.
-
- (Object) errors
Returns the value of attribute errors.
Attributes inherited from Logger
Instance Method Summary (collapse)
- - (Object) add(severity, message = nil, progname = nil)
-
- (ScraperLogger) initialize
constructor
A new instance of ScraperLogger.
- - (Object) note_error(exception, type, explanation = "")
- - (Object) note_phase(phase, type, explanation, exception = nil)
Methods inherited from Logger
Constructor Details
- (ScraperLogger) initialize
A new instance of ScraperLogger
47 48 49 |
# File 'lib/right_scraper/scraper_logger.rb', line 47 def initialize @errors = [] end |
Instance Attribute Details
- (Object) callback
Returns the value of attribute callback
28 29 30 |
# File 'lib/right_scraper/scraper_logger.rb', line 28 def callback @callback end |
- (Object) errors
Returns the value of attribute errors
27 28 29 |
# File 'lib/right_scraper/scraper_logger.rb', line 27 def errors @errors end |
Instance Method Details
- (Object) add(severity, message = nil, progname = nil)
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/right_scraper/scraper_logger.rb', line 30 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 |
- (Object) note_error(exception, type, explanation = "")
56 57 58 |
# File 'lib/right_scraper/scraper_logger.rb', line 56 def note_error(exception, type, explanation="") @errors << [exception, type, explanation] end |
- (Object) note_phase(phase, type, explanation, exception = nil)
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 |