Oopps, fix bug and make timestamp filename a bit more convenient

This commit is contained in:
Ozgun Ataman 2013-04-19 11:14:42 -07:00
parent 708e7ee334
commit 2dd2ee1b9c
2 changed files with 3 additions and 3 deletions

View file

@ -48,7 +48,7 @@ data LogInfo = LogInfo
logFileName :: String -> UTCTime -> FilePath
logFileName pre t = concat
[pre, "_", formatTime defaultTimeLocale "%F_%T%Q" t, ".log"]
[pre, "_", formatTime defaultTimeLocale "%Y_%m_%d_%H_%M_%S.%Q" t, ".log"]
------------------------------------------------------------------------------
-- | Creates a rotating log given a prefix and size limit in bytes.
@ -103,7 +103,7 @@ archiveFile
:: FilePath
-- ^ A target archive directory
-> (FilePath -> IO ())
archiveFile fp archive =
archiveFile archive fp =
let (dir, fn) = splitFileName fp
target = archive </> fn
in do

View file

@ -13,7 +13,7 @@ thread log pre n = do
thread log pre (n+1)
main = do
log <- mkRotatingLog "foo" 1000000 (const $ return ())
log <- mkRotatingLog "foo" 1000000 (archiveFile "logs")
a <- forkIO $ thread log "a" 0
b <- forkIO $ thread log "b" 0
c <- forkIO $ thread log "c" 0