-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation for File Logging #107
Comments
Better docs for this would definitely be a good thing. If we can come up with a solution, would you consider sending a doc PR? I think what you're looking for is the withLogFunc options1 $ \lf1 -> withLogFunc options2 $ \lf2 ->
runRIO (lf1 <> lf2) ... Does that work for you? |
Happy to put together a PR. :) That certainly compiles but it doesn't seem to be writing to file. Here's what I have:
This touches foo.txt but leaves it empty, and similarly if I run with just logFoo. What could be wrong here? |
I think it's a lack of flushing. Using {-# LANGUAGE NoImplicitPrelude #-}
import RIO
main = withBinaryFile "foo.txt" WriteMode $ \configHandle -> do
logStdout <- logOptionsHandle stdout True
logFoo <- logOptionsHandle configHandle True
withLogFunc logStdout $ \lfs ->
withLogFunc logFoo $ \lfo ->
runRIO (lfs <> lfo) $
logInfo . displayShow $ "foo" |
Hi, I can't find anywhere in the documentation that covers writing out a log to both a file and to stdout. I expected to be able to do something like this:
which is obviously wrong as LogOptions isn't a monoid, but I can't see the actual way to do this.
Thanks
The text was updated successfully, but these errors were encountered: