Skip to content

Commit

Permalink
Merge pull request #126 from srp/log_with_docs
Browse files Browse the repository at this point in the history
add document under what conditions log_with_stdout and log_with_stderr log
  • Loading branch information
gregwebs committed Mar 3, 2017
2 parents 70e68a2 + 9a14095 commit 5a5b911
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Shelly.hs
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

0 comments on commit 5a5b911

Please sign in to comment.