8000 print_commands cannot be captured by custom loggers · Issue #129 · gregwebs/Shelly.hs · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

print_commands cannot be captured by custom loggers #129

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

Open
shouya opened this issue Oct 7, 2016 · 2 comments
Open

print_commands cannot be captured by custom loggers #129

shouya opened this issue Oct 7, 2016 · 2 comments

Comments

@shouya
Copy link
shouya commented Oct 7, 2016

The following code demonstrates the problem:

main = shelly $ log_stdout_with myLogger $ print_commands True $ do
  run "ls" []

myLogger text = print $ "[OUT] " <> text

ls is printed but without [OUT] prefix, this means myLogger is not handling command printing.

Is it possible to capture all the commands like it for the outputs?

Why do I need this feature:

I'm writing a program that will run some shell commands and send all shell activities to a logger. Unfortunately at the time I can only capture stdout/stderr. The printed commands will be very helpful to locate errors and to trace what happened.

@gregwebs
Copy link
Owner
gregwebs commented Oct 7, 2016

I think you would just need to change this line: https://github.com/yesodweb/Shelly.hs/blob/master/src/Shelly.hs#L1201
to use sPrintStdout state.

@shouya
Copy link
Author
shouya commented Oct 9, 2016

In fact the command executed got print out to the console, except that this output can't be captured. So perhaps changing that line to sPrintStdout state ain't very useful.

I guess perhaps I should change echo cmdString to something else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0