[racket] Logger: change level at runtime?

From: Laurent (laurent.orseau at gmail.com)
Date: Tue Sep 10 15:11:40 EDT 2013

On Tue, Sep 10, 2013 at 6:49 PM, Greg Hendershott <greghendershott at gmail.com
> wrote:

> DrRacket: In the bottom pane (opened by View | Show Log), there's an
> edit control where you can tweak the levels for each logger (including
> the default logger). The default "error debug at GC debug at PLaneT" uses
> level 'error for the default logger and level 'debug for the loggers
> named GC land PLaneT. You can change interactively.
>
> XREPL: You can use its ",log <level>" command. But it's only for the
> default logger. You can't tweak other, named loggers added in 5.3.1.
> (I'd submitted a PR to add this awhile back [1]. I didn't know about
> DrRacket's level at logger syntax at the time, and used a different
> style. I'm realizing now maybe that's (part of) why the PR hasn't been
> accepted.)
>

Thanks for the info.

However do you mean you'd like the test code itself to change the
> level programmatically and re-run the test? I think you're saying the
> levels are an attribute of a _receiver_, and you can't
> (programmatically) change levels for the receivers that DrRacket or
> XREPL are using, because those are private and not accessible to your
> code. So you'd need the test code to make its own receiver (and I
> guess expect the user to "turn off" the default receiver provided by
> DrR or XREPL otherwise some dupes will be displayed)?
>

Yes, that's what I eventually figured out (in the gist link).

It's less simple than I thought at first, but simpler than I thought at
second.
The asynchronicity makes things a little harder to deal with (you
essentially
need to use the logger for all the messages you want to output, otherwise
it can become gibberish), but is also a nice feature to let the main
program
run smoothly.

Their parameterizability is also very nice, as it allows to completely shut
up
one thread while letting the other shout, even though they use the same
procedures.

I'm glad I took the step from `displayln' ;)

Laurent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130910/0b8814da/attachment.html>

Posted on the users mailing list.