on master help sign in
Make parsing severity case insensitive
commit73f62f702a20d8b9822f5d3676f722c439e50186 authorMichael Xavier <michael@michaelxavier.net> dateFri 18 Nov 2016, 16:07 (10 years ago) parent0d00101
1 file changed+11−9
katip/src/Katip/Core.hs+11−9
katip/src/Katip/Core.hs+11−9
@@ -139,15 +139,17 @@ renderSeverity s = case s of
139139
140140-------------------------------------------------------------------------------
141141textToSeverity :: Text -> Maybe Severity
142−textToSeverity "Debug" = Just DebugS
143−textToSeverity "Info" = Just InfoS
144−textToSeverity "Notice" = Just NoticeS
145−textToSeverity "Warning" = Just WarningS
146−textToSeverity "Error" = Just ErrorS
147−textToSeverity "Critical" = Just CriticalS
148−textToSeverity "Alert" = Just AlertS
149−textToSeverity "Emergency" = Just EmergencyS
150−textToSeverity _ = Nothing
142+textToSeverity = go . T.toLower
143+ where
144+ go "debug" = Just DebugS
145+ go "info" = Just InfoS
146+ go "notice" = Just NoticeS
147+ go "warning" = Just WarningS
148+ go "error" = Just ErrorS
149+ go "critical" = Just CriticalS
150+ go "alert" = Just AlertS
151+ go "emergency" = Just EmergencyS
152+ go _ = Nothing
151153
152154
153155instance ToJSON Severity where