class Daedalus::Logger

Public Class Methods

new(level=3) click to toggle source
   # File lib/daedalus.rb
21 def initialize(level=3)
22   @count = 0
23   @total = nil
24   @level = level
25 
26   @thread_count = 0
27   @count_mutex = Mutex.new
28 end

Public Instance Methods

command(cmd) click to toggle source
   # File lib/daedalus.rb
63 def command(cmd)
64   system cmd
65   if $?.exitstatus != 0
66     STDOUT.puts "Error: #{cmd}"
67     raise "Error compiling"
68   end
69 end
inc!() click to toggle source
   # File lib/daedalus.rb
51 def inc!
52   @count += 1
53 end
info(str) click to toggle source
   # File lib/daedalus.rb
77 def info(str)
78   if @level >= 3
79     STDOUT.puts "daedalus: #{str}"
80   end
81 end
show(kind, cmd) click to toggle source
   # File lib/daedalus.rb
55 def show(kind, cmd)
56   if @total
57     STDOUT.puts "[%3d/%3d] #{kind} #{cmd}" % [@count, @total]
58   else
59     STDOUT.puts "#{thread_id}: #{kind} #{cmd}"
60   end
61 end
start(count) click to toggle source
   # File lib/daedalus.rb
42 def start(count)
43   @count = 0
44   @total = count
45 end
stop() click to toggle source
   # File lib/daedalus.rb
47 def stop
48   @total = nil
49 end
thread_id() click to toggle source
   # File lib/daedalus.rb
30 def thread_id
31   id = Thread.current[:build_id]
32   unless id
33     @count_mutex.synchronize do
34       @thread_count += 1
35       id = Thread.current[:build_id] = @thread_count
36     end
37   end
38 
39   return id
40 end
verbose(str) click to toggle source
   # File lib/daedalus.rb
71 def verbose(str)
72   if @level >= 5
73     STDOUT.puts "daedalus: #{str}"
74   end
75 end