question about logging, if I define a logger with (define-logger foo) in main.rkt how do I make loggers like (log-foo-info ...) available to other procs in modules called by main.rkt?
@d_run I typically put that in a logger.rkt that main.rkt and other modules would require.
and they’re just made available or do I need to provide them?
You’d need to provide them. They’re just functions. There’s no handy provide-all-of-them-in-one-expression.
Either provide them one by one or maybe use all-defined-out
ah ok ok - lemme try that out
(A logger.rkt is where I’d put other fun such as setting current-trace-notify and friends to procs that shuttle traces to log-xxx-debug. Or shipping logs to AWS CloudWatch Logs or similar service.)
But yeah, maybe someone should make a tiny package — or submit a PR to racket itself — that augments define-logger with a define/provide-logger.
ah that worked great
i always get tripped up with logging - not a lot of examples out there
btw nice protip from your article on using JSON formatted logging with AWS
this reminds me — I have a function that accepts a logger and returns a function that collects the messages to that logger. Now its a package: https://github.com/bennn/make-log-interceptor