Skip to content
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

Output to file #314

Open
theGhostJW opened this issue Aug 3, 2024 · 7 comments
Open

Output to file #314

theGhostJW opened this issue Aug 3, 2024 · 7 comments
Labels
linear Created by Linear-GitHub Sync

Comments

@theGhostJW
Copy link
Contributor

theGhostJW commented Aug 3, 2024

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

@github-actions github-actions bot added the linear Created by Linear-GitHub Sync label Aug 3, 2024
@9999years
Copy link
Member

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

@theGhostJW
Copy link
Contributor Author

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
Copy link
Member

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

@theGhostJW
Copy link
Contributor Author

Yes, that's it

@smelc
Copy link

smelc commented Oct 29, 2024

I started using ghciwatch on the Haskell codebases I work on, and let me highlight that the feature request from this ticket would also have the nice consequence of making ghciwatch capable to produce the ghcid.txt file that is consumed by this vscode extension, meaning that ghciwatch would be capable of being plugged with very few effort with vscode (i.e. lower effort than https://github.com/josephsumabat/static-ls).

@9999years
Copy link
Member

@smelc ghciwatch can already produce ghcid.txt-compatible output with ghciwatch --error-file ghcid.txt. I think there's some hidden aliases like --outputfile for compatibility with ghcid too.

Redirecting STDOUT and not just errors would give more data, but the VSCode integration should work as-is.

@smelc
Copy link

smelc commented Nov 26, 2024

@9999years> as yes indeed, I confirm --error-file ghcid.txt works with VSCode's integration already. Nice ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

3 participants