Class: Jekyll::L10n::ExtractionLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-l10n/extraction/logger.rb

Overview

Logs extraction process errors and summary statistics.

ExtractionLogger provides centralized logging for the extraction pipeline, recording errors during extraction and final summary statistics including file count, string count, PO file creation count, and elapsed time.

Key responsibilities:

  • Log extraction errors with file context

  • Log extraction summary statistics

  • Format statistics output for user visibility

Class Method Summary collapse

Class Method Details

.log_error(file_path, error) ⇒ void

This method returns an undefined value.

Log an extraction error.

Parameters:

  • file_path (String)

    Path to file where error occurred

  • error (StandardError)

    The error that occurred



24
25
26
# File 'lib/jekyll-l10n/extraction/logger.rb', line 24

def self.log_error(file_path, error)
  Jekyll.logger.error 'Localization', "Error extracting from #{file_path}: #{error.message}"
end

.log_summary(stats, elapsed) ⇒ void

This method returns an undefined value.

Log extraction completion summary.

Logs final statistics about the extraction process including total files processed, strings extracted, PO files created/updated, and elapsed time.

Parameters:

  • stats (Hash)

    Statistics hash with keys:

    • :files_processed [Integer]

    • :strings_extracted [Integer]

    • :po_files_created [Integer]

  • elapsed (Float)

    Time elapsed in seconds



39
40
41
42
43
44
45
# File 'lib/jekyll-l10n/extraction/logger.rb', line 39

def self.log_summary(stats, elapsed)
  Jekyll.logger.info 'Localization', 'Extraction complete:'
  Jekyll.logger.info 'Localization', "  Files processed: #{stats[:files_processed]}"
  Jekyll.logger.info 'Localization', "  Strings extracted: #{stats[:strings_extracted]}"
  Jekyll.logger.info 'Localization', "  PO files created/updated: #{stats[:po_files_created]}"
  Jekyll.logger.info 'Localization', "  Time: #{elapsed.round(2)}s"
end