diff options
-rw-r--r-- | Utility/LogFile.hs | 15 | ||||
-rw-r--r-- | debian/changelog | 1 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Utility/LogFile.hs b/Utility/LogFile.hs index c45a1d405..1985b7eda 100644 --- a/Utility/LogFile.hs +++ b/Utility/LogFile.hs @@ -19,7 +19,7 @@ openLog logfile = do rotateLog :: FilePath -> Int -> IO () rotateLog logfile num - | num >= 10 = return () + | num > maxLogs = return () | otherwise = whenM (doesFileExist currfile) $ do rotateLog logfile (num + 1) renameFile currfile nextfile @@ -28,4 +28,15 @@ rotateLog logfile num nextfile = filename (num + 1) filename n | n == 0 = logfile - | otherwise = logfile ++ "." ++ show n + | otherwise = rotatedLog logfile n + +rotatedLog :: FilePath -> Int -> FilePath +rotatedLog logfile n = logfile ++ "." ++ show n + +{- Lists most recent logs last. -} +listLogs :: FilePath -> IO [FilePath] +listLogs logfile = filterM doesFileExist $ reverse $ + logfile : map (rotatedLog logfile) [1..maxLogs] + +maxLogs :: Int +maxLogs = 9 diff --git a/debian/changelog b/debian/changelog index 344081fa3..e08fc7876 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,7 @@ git-annex (3.20130115) UNRELEASED; urgency=low * webapp: Avoid an error if a transfer is stopped just as it finishes. Closes: #698184 * webapp: Now always logs to .git/annex/daemon.log. + * webapp: Now has a page to view the log, accessed from the control menu. -- Joey Hess <joeyh@debian.org> Mon, 14 Jan 2013 18:35:01 -0400 |