Is a simple color enabled logger for Haskell available?

haskell, logging, yesod

Solution

As of May 2012, the available logging libraries for Haskell are:

- hslogger - the venerable logging framework described in RWH.

- SessionLogger - a simple logging framework

And some more specialized ones:

- greg-client - a client to the greg distributed logging system

- fast-logger - a logging system optimized for fast IO

None support ansi terminal coloring output. There are several libraries for ansi coloring, so that shouldn't be too hard to add. E.g.

- ansi-terminal.

Problem

I would like to change the color of a log message output to the terminal depending on log level, topic, etc.,. The only logger I found that does this in Haskell is part of the xmonad-contrib package, but I don't want to take a dependency on it since it is rather large. I know that Yesod logs in color, but it is not obvious to me how to make its logger work outside of a Yesod web application. I looked into hslogger which seems to be very similar to System.Log.Logger, but neither seem to have color support out of the box. hslogger is extensible via custom `LogHandlers`, so possibly someone implemented one with color support? Are there alternatives for logging in Haskell I have overlooked so far? EDIT: Following Don Stewart's advice, I implemented a custom log handler that works with hslogger and ansi-c in order to allow logging to the terminal in colors.

Original source