]> gitweb.michael.orlitzky.com - dead/htsn.git/blobdiff - src/Configuration.hs
Tiny whitespace fix.
[dead/htsn.git] / src / Configuration.hs
index 7b237c5f1d0d350de28b8d00bc711fabcc78ee2c..a9d5463f612885d4d831d04ee13db1dad6c67864 100644 (file)
@@ -7,7 +7,8 @@ module Configuration (
   merge_optional )
 where
 
-import System.Console.CmdArgs.Default (Default(..))
+import System.Console.CmdArgs.Default ( Default(..) )
+import System.Log ( Priority( INFO ) )
 
 import qualified OptionalConfiguration as OC (OptionalConfiguration(..))
 import TSN.FeedHosts (FeedHosts(..))
@@ -15,15 +16,18 @@ import TSN.FeedHosts (FeedHosts(..))
 data Configuration =
   Configuration {
     feed_hosts       :: FeedHosts,
+    log_file         :: FilePath,
+    log_level        :: Priority,
     password         :: String,
     output_directory :: FilePath,
+    syslog           :: Bool,
     username         :: String }
     deriving (Show)
 
 -- | A Configuration with all of its fields set to their default
 --   values.
 instance Default Configuration where
-  def = Configuration def def "." def
+  def = Configuration def "htsn.log" INFO def "." True def
 
 
 -- | Merge a Configuration with an OptionalConfiguration. This is more
@@ -35,8 +39,11 @@ merge_optional :: Configuration
 merge_optional cfg opt_cfg =
   Configuration
     all_feed_hosts
+    (merge (log_file cfg) (OC.log_file opt_cfg))
+    (merge (log_level cfg) (OC.log_level opt_cfg))
     (merge (password cfg) (OC.password opt_cfg))
     (merge (output_directory cfg) (OC.output_directory opt_cfg))
+    (merge (syslog cfg) (OC.syslog opt_cfg))
     (merge (username cfg) (OC.username opt_cfg))
   where
     merge :: a -> Maybe a -> a
@@ -45,6 +52,6 @@ merge_optional cfg opt_cfg =
 
     -- If there are any optional usernames, use only those.
     all_feed_hosts = if (null (get_feed_hosts (OC.feed_hosts opt_cfg)))
-                    then (feed_hosts cfg)
-                    else (OC.feed_hosts opt_cfg)
+                     then (feed_hosts cfg)
+                     else (OC.feed_hosts opt_cfg)