Does anybody have a good example for log usage? I am quite confused as to how exactly I can use loggers and log-receivers. Maybe you have an app that uses loggers that I can take a look at?
@pocmatos Typed Racket uses logging to print out debug info about the progress of type checking
the logger is defined here I believe:
and you’ll see uses of do-time
spread throughout tc-toplevel.rkt
which is here:
if you raco make a typed racket file w/ the following you see the logged info printed out:
PLTSTDERR=debug@tr-timing raco make FILENAME.rkt
I’m not sure if this is a “good” or “simple” example — someone else might have a better example that is more straightforward or edifying
@pnwamk thanks, I will take a look
@pnwamk doesn’t help that much. I tried define-logger
but the created logger doesn’t actually display anything when I log to it. Do you know how it’s supposed to work?
For example logger.rkt> (define-logger foo)
logger.rkt> (log-foo-info "hello")
logger.rkt>
I was expecting an hello as default or something.
@pocmatos you’re not printing anything at that log level
try setting PLTSTDERR to info
and then trying it
ah… PLTSTDERR is what I was missing. To do things like logging to files, I then have to deal with log receivers and events, etc?
@samth do I need to restart racket?
@pocmatos maybe you want with-logging-to-port
http://docs.racket-lang.org/reference/logging.html#%28def._%28%28lib._racket%2Flogging..rkt%29._with-logging-to-port%29%29
(in case it helps, here’s a paste that uses with-intercepted-logging
http://pasterack.org/pastes/14948)
In DrRacket or racket-mode there’s a receiver already running and you can tweak what it shows (which loggers and the threshold level for each). EDIT: Overlooked the logging to files part. nvm
Hello everyone! I’ll need to parse PHP code, and am considering various possible options. I see that Racket has support for building parsers but I’d like to reuse something existing if possible. I noticed there actually is a PHP parser written in Racket (https://github.com/antoineB/php-parser), is anyone familiar with it? I’d also like to know what “plain php files” means in the project description… I guess PHP only code without HTML? Many thanks!