pocmatos
2017-2-24 17:11:20

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?


pnwamk
2017-2-24 17:19:04

@pocmatos Typed Racket uses logging to print out debug info about the progress of type checking


pnwamk
2017-2-24 17:19:11

the logger is defined here I believe:



pnwamk
2017-2-24 17:19:30

and you’ll see uses of do-time spread throughout tc-toplevel.rkt which is here:



pnwamk
2017-2-24 17:20:36

if you raco make a typed racket file w/ the following you see the logged info printed out:


pnwamk
2017-2-24 17:20:36

PLTSTDERR=debug@tr-timing raco make FILENAME.rkt


pnwamk
2017-2-24 17:21:10

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


pocmatos
2017-2-24 17:34:16

@pnwamk thanks, I will take a look


pocmatos
2017-2-24 17:52:09

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


pocmatos
2017-2-24 17:53:03

For example logger.rkt> (define-logger foo) logger.rkt> (log-foo-info "hello") logger.rkt>


pocmatos
2017-2-24 17:53:19

I was expecting an hello as default or something.


samth
2017-2-24 17:56:26

@pocmatos you’re not printing anything at that log level


samth
2017-2-24 17:56:36

try setting PLTSTDERR to info and then trying it


pocmatos
2017-2-24 17:59:40

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?


pocmatos
2017-2-24 18:15:11

@samth do I need to restart racket?



ben
2017-2-24 18:30:24

(in case it helps, here’s a paste that uses with-intercepted-logging http://pasterack.org/pastes/14948)


greg
2017-2-24 21:16:23

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


dnf85
2017-2-24 22:09:36

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!