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

From: Greg Hendershott (greghendershott at gmail.com)
Date: Thu Aug 30 10:32:17 EDT 2012

Thanks, Robby.

Do you mean I could do something like this?

(define (enable-log-output level)
  (let ([r (make-log-receiver (current-logger) level)])
    (thread
     (lambda ()
       (let loop ()
         (match (sync r)
                [(vector lvl msg v)
                 (printf "; [~a] ~a\n" lvl msg)])
         (loop))))))
(enable-log-output 'debug)

If so, then:

1. I don't see what you mean re being able to do more than string
munging. `v' is a continuation-mark-set. Is that the struct you mean?

But stipulating I could filter in whatever fashion ...

2. Putting this in every source file doesn't seem practical? I'm
talking about doing interactive development, using XREPL's ,log
command. Open a file, evaluate it, make some changes, maybe use ,log
to tweak the log output level, evaluate, move on to another file. That
sort of work-flow.

3. I have to ask users of my collections to use code like this, to
avoid getting "drowned" in my log-debug output? That doesn't sound
good.


,log already does filtering on one "dimension" ("severity") without
touching your source, which is great. It seems odd to have to use
per-file code, in order to filter on another dimension ("facility" or
"module").


On Thu, Aug 30, 2012 at 8:55 AM, Robby Findler
<robby at eecs.northwestern.edu> wrote:
> On Thu, Aug 30, 2012 at 6:29 AM, Greg Hendershott
> <greghendershott at gmail.com> wrote:
>> I have some code with copious log-debug calls. Occasionally I set
>> ",log debug" to see the output.
>>
>> New in 5.3, I'm seeing many dozens of outputs like the following:
>>
>> ; [debug] mzc optimizer: inlining: involving: core727 in: unpack728 in
>> module: 's3 size: 149 threshold: 320
>>
>> These are interleaved with and badly obscuring my own debug output.
>>
>> I've been trying to ignore these and live with it the last couple
>> weeks, but it's proving difficult.
>>
>> 1. Narrow question: Is there a way I can disable the mzc debug output,
>> while preserving my own?
>
> You can set up your own log receiver and filter out the messages that
> you want (note that you can filter based on racket data structures,
> not just string munging as log messages have a value associated with
> them that you can query).
>
> Robby

Posted on the users mailing list.