Module: Musa::Logger

Included in:
All
Defined in:
lib/musa-dsl/logger/logger.rb

Overview

Logging utilities for Musa DSL.

Provides a specialized logger that integrates with the sequencer to display musical position information alongside standard log messages.

Purpose

When working with sequenced musical compositions, it's crucial to know at what point in musical time events occur. This logger automatically prepends the sequencer's current position (in bars) to each log entry, making debugging and monitoring much more intuitive.

Integration with Sequencer

The logger reads the sequencer's position at the moment each log message is generated. Since positions are typically Rational numbers representing bars (e.g., 4/4 = 1 bar), the InspectNice refinement ensures they display in a readable decimal format.

Common Use Cases

  • Debugging sequencer timing issues
  • Monitoring MIDI output events with their musical timestamps
  • Tracking series evaluation progress
  • Logging voice state changes during playback
  • Performance analysis and timing verification

Examples:

Complete workflow

require 'musa-dsl'

# Setup
sequencer = Musa::Sequencer::Sequencer.new(4, 24)
logger = Musa::Logger::Logger.new(sequencer: sequencer)
logger.level = Logger::INFO

# In your composition
sequencer.at 0 do
  logger.info "Composition started"
end

sequencer.at 4 do
  logger.info "First phrase complete"
end

sequencer.run

# Output:
#  0.000: [INFO] Composition started
#  4.000: [INFO] First phrase complete

See Also:

Defined Under Namespace

Classes: Logger