Skip to content
Browse files

debug logging

  • Loading branch information...
1 parent 65b9cd6 commit 1c8f942a014a8141ca0b00e0fb37f7718b7ce790 @glucero committed Nov 10, 2012
View
5 source/lib/fusuma.rb
@@ -55,7 +55,12 @@ def applicationDidFinishLaunching(notification)
configuration = Configuration.new
@layouts = configuration.layouts
+
+ log.debug 'Layouts created.'
+
@keymap = configuration.keymap(@layouts.first) # use only 1 layout right now
+
+ log.debug 'Keymaps created.'
rescue => error
log.error error.message
log.error error.backtrace.join("\n")
View
9 source/lib/fusuma/configuration.rb
@@ -2,6 +2,7 @@ module Fusuma
class Configuration
+ include Logger
include Properties
def layouts
@@ -12,7 +13,11 @@ def layouts
read_configuration do |layouts, keymap|
@keymap = keymap
layouts = layouts.map { |l| Layout.load(l) }
+
+ log.debug "#{layouts.count} layouts configured."
+
layouts.zip(Workspace.desktops) do |layout, desktop|
+
layout.scale_to desktop unless desktop.nil?
end
@@ -22,6 +27,9 @@ def layouts
def keymap(layout)
KeyMap.new(layout) do |keymap|
+
+ log.debug "#{@keymap.count} keymaps configured."
+
@keymap.each do |action, sequence|
keymap.add(action, sequence)
end
@@ -33,6 +41,7 @@ def keymap(layout)
def read_configuration
File.open(CONFIG, 'r') do |file|
file = JSON.parse(file.read)
+
yield file.values
end
end
View
7 source/lib/fusuma/layout.rb
@@ -2,6 +2,7 @@ module Fusuma
class Layout < Array
+ include Logger
include Properties
attr_accessor :frames, :scale
@@ -19,7 +20,11 @@ def self.all
end
def self.load(name)
- config = Layout.all.find { |l| l.name.eql? name }
+ layouts = Layout.all
+
+ log.debug "#{layouts.count} layouts found."
+
+ config = layout.find { |l| l.name.eql? name }
Layout.new(config.scale, config.frames)
end
View
3 source/lib/fusuma/status_bar_window.rb
@@ -2,6 +2,7 @@ module Fusuma
class StatusBarWindow < NSWindow
+ include Logger
include Properties
X = Y = 0.0
@@ -10,6 +11,8 @@ class StatusBarWindow < NSWindow
def init(frame, controller)
@controller = controller
+ log.info 'Initializing StatusBarWindow'
+
window = create(Area(frame.origin.x, (frame.origin.y - H), W, H))
window.contentView.addSubview(create_button)
window

0 comments on commit 1c8f942

Please sign in to comment.
Something went wrong with that request. Please try again.