module Colog.Syslog.Message
(
Message (..)
, severity
, content
, fmtMessageFlat
) where
import Universum
import Colog.Syslog.Priority (Severity(..))
import Fmt ((|+), (|++|))
import Lens.Micro (Lens', lens)
data Message = Message
{ msgSeverity :: !Severity
, msgContent :: !Text
} deriving (Show)
severity :: Lens' Message Severity
severity = lens msgSeverity $ \message svr -> message { msgSeverity = svr }
content :: Lens' Message Text
content = lens msgContent $ \message cnt -> message { msgContent = cnt }
fmtMessageFlat :: Message -> Text
fmtMessageFlat Message {..} = msgSeverity|++|msgContent|+""