[racket] Logger: change level at runtime?

From: Greg Hendershott (greghendershott at gmail.com)
Date: Tue Sep 10 12:49:35 EDT 2013

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.)

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)?


[1]: https://github.com/plt/racket/pull/188


On Tue, Sep 10, 2013 at 11:28 AM, Laurent <laurent.orseau at gmail.com> wrote:
> Hmm, I've just understood that I had misunderstood how the logger works.
> Any receiver can define the level it is interested in.
> The command-line and environment parameters are only for the default logger
> then?
>
> If this can help anyone else, here is a simple usage example of Racket's
> logging facility:
> https://gist.github.com/Metaxal/6511048
>
> Laurent
>
>
> On Tue, Sep 10, 2013 at 4:54 PM, Laurent <laurent.orseau at gmail.com> wrote:
>>
>> Is there a way to change the logging level at runtime?
>>
>> I'd like to run tests from within DrRacket, and when one fails, I'd like
>> to restart the test with a higher level, or raise the level and then do some
>> evals in the interaction window.
>>
>> Laurent
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>

Posted on the users mailing list.