Parent

Methods

Included Modules

Class Index [+]

Quicksearch

Ramaze::Logger::Xosd

Informer for the XOSD notification system for X11.

You can install the ruby-bindings with:

    gem install xosd.

Constants

DEFAULT
IGNORE

keys to ignore when setting the options to the instance.

QUEUE

Here new messages are pushed to eventually displaying them.

Attributes

options[RW]

Public Class Methods

new(options = {}) click to toggle source

Create a new instance, valid options are in DEFAULT. In the background a new thread will be running that checks the QUEUE and processes all messages that are being sent to it. This is done to make output nicer and readable.

    # File lib/ramaze/log/xosd.rb, line 53
53:       def initialize(options = {})
54:         @options = DEFAULT.merge(options)
55: 
56:         super(@options[:lines])
57: 
58:         @options.each do |key, value|
59:           next if IGNORE.include?(key)
60:           value = @options[:font_size] if key == :font
61:           send("#{key}=", value)
62:         end
63: 
64:         Thread.new(self) do |xosd|
65:           loop do
66:             items = []
67:             lines = xosd.options[:lines]
68:             items << QUEUE.shift until QUEUE.empty? or items.size >= lines
69: 
70:             unless items.empty?
71:               # pad up with empty lines to avoid dragging around old messages.
72:               items << [:info, ' '] until items.size >= lines
73: 
74:               items.each_with_index do |(tag, message), i|
75:               xosd.color = xosd.options[:colors][tag.to_sym]
76:               xosd.display(message, i)
77:               end
78:             end
79:             sleep xosd.options[:timeout]
80:           end
81:         end
82:       end

Public Instance Methods

log(tag, *messages) click to toggle source

Pushes all messages it gets on the QUEUE for further processing.

    # File lib/ramaze/log/xosd.rb, line 87
87:       def log(tag, *messages)
88:         messages.each do |message|
89:           QUEUE << [tag, message]
90:         end
91:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.