From 2dd2ee1b9cfe0bd84aabb4a009c8051766dcd063 Mon Sep 17 00:00:00 2001 From: Ozgun Ataman Date: Fri, 19 Apr 2013 11:14:42 -0700 Subject: [PATCH] Oopps, fix bug and make timestamp filename a bit more convenient --- src/System/RotatingLog.hs | 4 ++-- test/TestRotate.hs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/System/RotatingLog.hs b/src/System/RotatingLog.hs index fafaf2c..158d249 100644 --- a/src/System/RotatingLog.hs +++ b/src/System/RotatingLog.hs @@ -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 diff --git a/test/TestRotate.hs b/test/TestRotate.hs index d0ffc4e..ce3f52c 100644 --- a/test/TestRotate.hs +++ b/test/TestRotate.hs @@ -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