Permalink
Browse files

Include level in source

  • Loading branch information...
1 parent 74cf1f7 commit ae23dee4abc636375993a7958cf3811deb2cfee0 @snoyberg snoyberg committed Oct 13, 2012
Showing with 8 additions and 2 deletions.
  1. +7 −2 yesod-core/Yesod/Internal/Core.hs
  2. +1 −0 yesod-core/helloworld.hs
@@ -326,7 +326,7 @@ $doctype 5
-> IO ()
messageLoggerSource a logger loc source level msg =
if shouldLog a source level
- then formatLogMessage (loggerDate logger) loc level msg >>= loggerPutStr logger
+ then formatLogMessage (loggerDate logger) loc source level msg >>= loggerPutStr logger
else return ()
-- | The logging level in place for this application. Any messages below
@@ -376,10 +376,11 @@ $doctype 5
formatLogMessage :: IO ZonedDate
-> Loc
+ -> LogSource
-> LogLevel
-> LogStr -- ^ message
-> IO [LogStr]
-formatLogMessage getdate loc level msg = do
+formatLogMessage getdate loc src level msg = do
now <- getdate
return
[ LB now
@@ -388,6 +389,10 @@ formatLogMessage getdate loc level msg = do
case level of
LevelOther t -> T.unpack t
_ -> drop 5 $ show level
+ , LS $
+ if T.null src
+ then ""
+ else "#" ++ T.unpack src
, LB "] "
, msg
, LB " @("
View
@@ -43,6 +43,7 @@ instance Yesod HelloWorld where
getRootR = do
$(logOther "HAHAHA") "Here I am"
+ $logOtherS "source" "level" "message"
defaultLayout $ do
addScriptRemote "https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"
toWidget [julius|$(function(){$("#mypara").css("color", "red")});|]

0 comments on commit ae23dee

Please sign in to comment.