MercuryTechnologies / ghciwatch

Load a GHCi session for a Haskell project and reload it when source files change
https://mercurytechnologies.github.io/ghciwatch/
MIT License
111 stars 10 forks source link

Output to file #314

Open theGhostJW opened 2 months ago

theGhostJW commented 2 months ago

Describe the feature you’d like to be implemented

In ghcid I can have the console output also copied to a log file as text (not json log format) by adding an -o switch

e.g. ghcid --command 'cabal repl' pyrethrum --allow-eval --clear --no-height-limit '-o ghcid.log'

it would be great to have an equivalent feature in ghciwatch.

List alternatives to the feature and their pros and cons

No response

Additional context

I have found this feature very useful for debugging output which were long lists of pretty printed logs

9999years commented 2 months ago

Does the --error-file option fill this need?

theGhostJW commented 2 months ago

Hi, No its not the same. I am running endpoints which generate large pretty printed log entries being printed to stdout with putStrLn. When I run the above ghci command I get the full log (actually the full console output) written to the ghcid.log file.

If I use --error-file with ghiwatch I just get a log of the initial load error that triggers the lazy loading of the required modules and nothing else. So I guess --error-file is doing as described on the box and just logging errors where as ghcid's -o ghcid.log is giving me everything.

9999years commented 2 months ago

OK, so you also want to redirect the GHCi session's stdout to a file?

theGhostJW commented 2 months ago

Yes, that's it