Move Log types from Logger to Types

portnov [2009-07-07 07:46:42]
Move Log types from Logger to Types
Filename
Framework/API.hs
Framework/Logger.hs
Framework/Models.hs
Framework/Types.hs
diff --git a/Framework/API.hs b/Framework/API.hs
index 340a336..5cd25cb 100644
--- a/Framework/API.hs
+++ b/Framework/API.hs
@@ -10,7 +10,7 @@ module Framework.API
      queryListSQL, queryListSQL', querySQL, querySQL',
      getcookie, setcookie,
      accessLog, errorLog
-    )where
+    ) where

 import Debug.Trace

@@ -32,8 +32,6 @@ import Framework.Models (Model)
 import Framework.Http.Response ((<+>))
 import Framework.Http.HTTPServer (serveHttp,serveStatic)

-trace' x = trace (show x) x
-
 ----------------------------------------------------------------------------------------------------------
 -- * Sessions API

diff --git a/Framework/Logger.hs b/Framework/Logger.hs
index 7529908..b32be8a 100644
--- a/Framework/Logger.hs
+++ b/Framework/Logger.hs
@@ -16,15 +16,7 @@ import Control.Concurrent.Chan
 import Text.Printf
 import Network.HTTP

-data LogItem = LogItem {
-    logRequest :: Request String,
-    logTime :: String,
-    logMessage :: String }
-
-type Log = Chan LogItem
-
-instance Show Log where
-    show _ = "<Log channel>"
+import Framework.Types

 currentTime :: IO String
 currentTime = do
diff --git a/Framework/Models.hs b/Framework/Models.hs
index c17481e..03d4184 100644
--- a/Framework/Models.hs
+++ b/Framework/Models.hs
@@ -38,7 +38,7 @@ data Model = Model {
     mName :: String,                       -- ^ Model name
     mTable :: String,                      -- ^ DB table name
     mFields :: [ModelField],               -- ^ List of model fields (DB table columns)
-    mCached :: [ModelFie ld]               -- ^ Additional fields, which are no in DB
+    mCached :: [ModelField]                -- ^ Additional fields, which are no in DB
     }
     deriving (Eq,Show)

diff --git a/Framework/Types.hs b/Framework/Types.hs
index 7fc2ca7..c43b5aa 100644
--- a/Framework/Types.hs
+++ b/Framework/Types.hs
@@ -2,6 +2,7 @@
 module Framework.Types where

 import System.IO
+import Control.Concurrent.Chan
 import Data.List
 import qualified Data.Map as M
 import qualified Database.HDBC as D
@@ -10,7 +11,6 @@ import Network.HTTP
 import Framework.Http.SessionTypes
 import Framework.CacheTypes
 import Framework.Pool
-import Framework.Logger

 ----------------------------------------------------------------
 --Types
@@ -64,6 +64,18 @@ repackHeader hdr = (show $ hdrName hdr, hdrValue hdr)
 packParam :: (String,String) -> UrlParam
 packParam (n,v) = (n := v)

+--------------------------------------------------------------------------------------------
+
+data LogItem = LogItem {
+    logRequest :: Request String,
+    logTime :: String,
+    logMessage :: String }
+
+type Log = Chan LogItem
+
+instance Show Log where
+    show _ = "<Log channel>"
+
 -------------------------------------------------------------------------------------------

 -- | Single item to render in template.
ViewGit