module Colog.Polysemy.Formatting.LogEnv
( LogEnv(..)
, newLogEnv
) where
import Data.Time (TimeZone, getCurrentTimeZone)
import System.IO (Handle)
import Colog.Polysemy.Formatting.Color (UseColor, termColorSupport)
data LogEnv = LogEnv UseColor TimeZone
newLogEnv :: Handle -> IO LogEnv
newLogEnv :: Handle -> IO LogEnv
newLogEnv Handle
h = do
TimeZone
zone <- IO TimeZone
getCurrentTimeZone
UseColor
useColor <- Handle -> IO UseColor
termColorSupport Handle
h
LogEnv -> IO LogEnv
forall (f :: * -> *) a. Applicative f => a -> f a
pure (LogEnv -> IO LogEnv) -> LogEnv -> IO LogEnv
forall a b. (a -> b) -> a -> b
$ UseColor -> TimeZone -> LogEnv
LogEnv UseColor
useColor TimeZone
zone