summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJed Barber <jjbarber@y7mail.com>2017-01-23 19:41:29 +1100
committerJed Barber <jjbarber@y7mail.com>2017-01-23 19:41:29 +1100
commit37180398da12c35e028f0f08635814be30bb6ab5 (patch)
tree3ec2de0f9538574ab455f70128d60eab7ee0fd32 /src
parentc95d1cc837f09c3a8b79ed03b6ab9076b37e61c0 (diff)
Verbosity now outputs to stderr
Diffstat (limited to 'src')
-rw-r--r--src/Election.hs2
-rw-r--r--src/main.hs12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/Election.hs b/src/Election.hs
index 350d652..be4fe05 100644
--- a/src/Election.hs
+++ b/src/Election.hs
@@ -223,7 +223,7 @@ doElectCandidate e = do
then do
let logmsg = show (getID electedEntry) ++ " elected at logfile #" ++ show (getNextLogNum e)
MIO.liftIO $ IO.appendFile (getMainLog e) (logmsg ++ "\n")
- MIO.liftIO $ Con.when (isVerbose e) (putStrLn logmsg)
+ MIO.liftIO $ Con.when (isVerbose e) (IO.hPutStrLn IO.stderr logmsg)
ET.right (e
{ getEntries = allRevised
, getTransferQueue = (getTransferQueue e) ++ [newTransfer]
diff --git a/src/main.hs b/src/main.hs
index b0baaa4..8cec703 100644
--- a/src/main.hs
+++ b/src/main.hs
@@ -4,6 +4,7 @@ import qualified System.Environment as Env
import qualified System.Console.GetOpt as Opt
import qualified System.Exit as Ex
import qualified System.Directory as Dir
+import qualified System.IO as IO
import qualified Control.Monad as Con
import qualified Data.Maybe as Maybe
import qualified Counter as Sen
@@ -174,18 +175,19 @@ main = do
-- set up the election processing
+ Con.when (isVerbose options) $ IO.hPutStrLn IO.stderr "Reading candidate data..."
(aboveBallot, belowBallot) <- Cand.readCandidates candidateFile state
- Con.when (isVerbose options) $ putStrLn "Reading preference data..."
+ Con.when (isVerbose options) $ IO.hPutStrLn IO.stderr "Reading preference data..."
counter <- Sen.createSenateCounter preferenceFile aboveBallot belowBallot
- Con.when (isVerbose options) $ putStrLn "Done.\n"
+ Con.when (isVerbose options) $ IO.hPutStrLn IO.stderr "Done.\n"
Dir.createDirectory outputDir
- Con.when (isVerbose options) $ putStrLn "Setting up election..."
+ Con.when (isVerbose options) $ IO.hPutStrLn IO.stderr "Setting up election..."
election <- Elt.createElection outputDir counter numToElect (isVerbose options)
- Con.when (isVerbose options) $ putStrLn "Done.\n"
+ Con.when (isVerbose options) $ IO.hPutStrLn IO.stderr "Done.\n"
-- run the show
- Con.when (isVerbose options) $ putStrLn "Running...\n"
+ Con.when (isVerbose options) $ IO.hPutStrLn IO.stderr "Running...\n"
Elt.doCount election