[racket-dev] console output

From: Eli Barzilay (eli at barzilay.org)
Date: Fri Dec 10 10:54:45 EST 2010

About two weeks ago, Matthew Flatt wrote:
> Pango likes to warn you when it sets up certain font substitutions.
> I don't know whether there's any way to turn it off.

This bugged me a little, then when I got the same warnings on windows
it became more annoying.  To make a long story short, the warnings are
made with g_warning(), which has some gnome system for sending log
events, and apparently there is a default handler that handles events
with no other handler -- and this default handler is the noisy one.
There's a bunch of ways that are supposed to disable this, including
an environment variable (that can make warnings fatal and probably
nothing else), and a way to set handlers (which I couldn't get to
work) -- what eventually worked is a function that sets the default

  winooski:~ eli> grt
  Welcome to Racket v5.0.99.4.
  -> ,r ffi/unsafe
  -> (define h! (get-ffi-obj 'g_log_set_default_handler #f (_fun (_fun _string _uint _string _pointer -> _void) _pointer -> _uint)))
  -> (h! (lambda (domain level msg _) (log-warning (format "[~a] ~a" domain msg))) #f)
  -> ,r drracket

This fires up drr -- silently, at last.  Adding a `-W all' shows the

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!

Posted on the dev mailing list.