Add configurable log levels and log file support
Build / build (push) Failing after 7s

- New LogLevel type: Debug, Info, Warn, Error with Ord instance
- Logger holds configured level and output handle (stderr or file)
- --log-level and --log-file CLI flags
- log_level and log_file YAML config fields
- Log messages assigned appropriate severity levels
- Test logger updated to new Logger structure
- All 17 tests passing
This commit is contained in:
2026-05-14 10:13:36 -04:00
parent d22ea39cde
commit f66dfcbccb
5 changed files with 152 additions and 45 deletions
+4 -3
View File
@@ -16,12 +16,13 @@ module TestHelper (
) where
import Control.Concurrent.MVar (newMVar)
import Converge (Logger (..))
import Converge (Logger (..), LogLevel (..))
import Data.Text (Text)
import qualified Data.Text as T
import System.Directory (createDirectory)
import System.Exit (ExitCode)
import System.FilePath ((</>))
import System.IO (stderr)
import System.IO.Temp (withSystemTempDirectory)
import System.Process (readProcessWithExitCode)
@@ -37,9 +38,9 @@ rawGit args = do
(code, out, err) <- readProcessWithExitCode "git" args ""
pure (code, T.pack out, T.pack err)
-- | Create a test logger (serialized writes to stderr).
-- | Create a test logger (serialized writes to stderr, Debug level).
testLogger :: IO Logger
testLogger = Logger <$> newMVar ()
testLogger = Logger <$> newMVar () <*> pure Debug <*> pure stderr
{- | Create a temporary git repository, configure a user, make an initial
commit on branch "main", run the action with the repo path, then clean up.