Wednesday, August 8, 2007

Ruby and Syslog

As others have also pointed out there is no ri documentation for the syslog module but there is a lot of useful stuff in the ext/syslog directory.

But here is the most basic example I can come up with:

irb(main):007:0> mdfranz@franz-t61:~$ irb
irb(main):001:0> require 'syslog'
=> true
=> <#Syslog: opened=true, ident="labradoodle", options=3, facility=8, mask=255>
irb(main):003:0> Syslog.crit('w00f w00f')
=> <#Syslog: opened=true, ident="labradoodle", options=3, facility=8, mask=255>
irb(main):004:0> Syslog.close
=> nil
irb(main):005:0> Syslog.crit('w00f w00f')
RuntimeError: must open syslog before write
from (irb):5:in `crit'
from (irb):5
from :0

And /var/log/syslog

Aug 8 10:03:22 franz-t61 labradoodle[3688]: w00f w00f
Aug 8 10:04:24 franz-t61 kernel: [ 9700.304000] iwl4965: REPLY_ADD_STA failed
Aug 8 10:06:27 franz-t61 kernel: [ 9823.088000] iwl4965: REPLY_ADD_STA failed

Sunday, August 5, 2007

Debian + FXRI + Rubygems is Englightenment!

So unlike OSX FXRI on Debian (Etch) is a snap. This assumes you are running a self compiled 1.8.6 install with gems. All I had to do was apt-get install the following packages:

  • libfox-1.6-0
  • libfox-1.6-dev

    All you really need is the *-dev of course. Which resulted in the following additional packages being installed:

    The following NEW packages will be installed:
    libcupsys2-dev libexpat1-dev libfontconfig1-dev libfox-1.6-0 libfox-1.6-dev
    libfox-1.6-doc libfreetype6-dev libgcrypt11-dev libgnutls-dev
    libgpg-error-dev libjpeg62-dev liblzo-dev libopencdk8-dev libpng12-dev
    libpopt-dev libtasn1-3-dev libtiff4-dev libtiffxx0c2 libxcursor-dev
    libxfixes-dev libxft-dev libxrender-dev x11proto-fixes-dev

    And then

    root@franz-t61:~/Desktop/Downloads/ruby-1.8.6# gem install fxri
    Need to update 3 gems from
    Install required dependency fxruby? [Yn] Y
    Select which gem to install for your platform (i686-linux)
    1. fxruby 1.6.11 (ruby)
    2. fxruby 1.6.11 (mswin32)
    3. fxruby 1.6.10 (mswin32)
    4. fxruby 1.6.10 (ruby)
    5. Skip this gem
    6. Cancel installation
    > 1
    Building native extensions. This could take a while...
    Successfully installed fxri-0.3.6
    Successfully installed fxruby-1.6.11
    Installing ri documentation for fxruby-1.6.11...
    Installing RDoc documentation for fxruby-1.6.11...

  • And even more amazingly, all the fifteen thousand of the API docs (builtins and gems) are there! Now the only thing weird was I had to fix the path env in the fxri start script.