Module: Bash::Merge::DebugLogger

Extended by:
Ast::Merge::DebugLogger
Defined in:
lib/bash/merge/debug_logger.rb

Overview

Debug logging utility for Bash::Merge. Extends the base Ast::Merge::DebugLogger with Bash-specific configuration.

Examples:

Enable debug logging

ENV['BASH_MERGE_DEBUG'] = '1'
DebugLogger.debug("Processing node", {type: "function_definition", line: 5})

Disable debug logging (default)

DebugLogger.debug("This won't be printed", {})

Class Method Summary collapse

Class Method Details

.log_node(node, label: "Node") ⇒ Object

Override log_node to handle Bash-specific node types.

Parameters:

  • node (Object)

    Node to log information about

  • label (String) (defaults to: "Node")

    Label for the node



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/bash/merge/debug_logger.rb', line 26

def log_node(node, label: "Node")
  return unless enabled?

  info = case node
  when Bash::Merge::FreezeNode
    {type: "FreezeNode", lines: "#{node.start_line}..#{node.end_line}"}
  when Bash::Merge::NodeWrapper
    {type: node.type.to_s, lines: "#{node.start_line}..#{node.end_line}"}
  else
    extract_node_info(node)
  end

  debug(label, info)
end