[racket] 5.3's "mzc optimizer" log-debug, and log "facility" in general

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Thu Aug 30 12:07:23 EDT 2012

Matthew Flatt wrote at 08/30/2012 11:28 AM:
> At Thu, 30 Aug 2012 10:50:01 -0400, Greg Hendershott wrote:
>> So you can define multiple and hierarchical loggers. It seems like
>> this is the intended way to handle something like a "facility"?
> It looks like we're going to add a `current-optimization-logger'
> parameter to Racket, and the optimizer will send its messages there.
> So, you won't see optimizer messages when you look at debug messages to
> the main logger.
> Maybe we should also add an environment variable that causes the
> initial optimization logger to make itself a child of the main logger.
> Then, when you set the environment variable and look at messages to the
> main logger, you would see optimization logging, too. (Is there a
> better way to go than environment variables?)
> Would that be a good way to externally select logging information in
> general? I imagine a form
>   (define-logger zoo)
> that binds
>   current-zoo-logger
>   log-zoo-error
>   log-zoo-warning
> etc., and arranges for the initial zoo logger to be a child of the
> current logger iff the ZOO_LOG environment variable is set.

Will this result in an explosion of potential environment variables to 
maybe on average one per Racket library, and will this conflict with 
non-Racket-related environment variables in practice?

And will "PLTSTDERR=debug" (and the analog of that in DrRacket) still 
work for getting all the messages, including "zoo" ones?

I'm guessing you could make the above "define-logger" approach perform a 
lot better in some cases than the following?

(log-debug 'zoo "this is my message")

PLTSTDERR="error zoo=debug circus=warning"

Neil V.

Posted on the users mailing list.