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

add document under what conditions log_with_stdout and log_with_stderr log #126

Merged
merged 1 commit into from
Mar 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Shelly.hs
Original file line number Diff line number Diff line change
Expand Up @@ -828,12 +828,18 @@ verbosely a = sub $ modify (\x -> x
, sPrintCommands = True
}) >> a

-- | Create a sub-Sh in which stdout is sent to the user-defined logger
-- | Create a sub-Sh in which stdout is sent to the user-defined
-- logger. When running with 'silently' the given log will not be
-- called for any output. Likewise the log will also not be called for
-- output from 'run_' and 'bash_' commands.
log_stdout_with :: (Text -> IO ()) -> Sh a -> Sh a
log_stdout_with logger a = sub $ modify (\s -> s { sPutStdout = logger })
>> a

-- | Create a sub-Sh in which stderr is sent to the user-defined logger
-- | Create a sub-Sh in which stderr is sent to the user-defined
-- logger. When running with 'silently' the given log will not be
-- called for any output. However, unlike 'log_stdout_with' the log
-- will be called for output from 'run_' and 'bash_' commands.
log_stderr_with :: (Text -> IO ()) -> Sh a -> Sh a
log_stderr_with logger a = sub $ modify (\s -> s { sPutStderr = logger })
>> a
Expand Down