on master help sign in
Export severity/text prism

This will end up coming in handy when taking user input specifying severity (i.e. for log searching). It isn't really sufficient to lean on the JSON instance because JSON requires a toplevel object or array.

commitbbaaa639e3136d545c97d9840dce3396f2193e5a authorMichael Xavier <michael@michaelxavier.net> dateTue 29 Sep 2015, 15:25 (11 years ago) parent09effe5
2 files changed+4−10
katip/src/Katip.hs+3−1 katip/src/Katip/Core.hs+1−9
katip/src/Katip.hs+3−1
@@ -6,7 +6,9 @@ module Katip
66 Katip (..)
77 , Namespace (..)
88 , Environment (..)
9− , Severity (..), renderSeverity
9+ , Severity (..)
10+ , renderSeverity
11+ , severityText
1012 , Verbosity (..)
1113 , ToObject (..)
1214 , LogItem (..)
katip/src/Katip/Core.hs+1−9
@@ -112,16 +112,8 @@ renderSeverity s = case s of
112112
113113-------------------------------------------------------------------------------
114114severityText :: Prism' Text Severity
115−severityText = prism fromSev toSev
115+severityText = prism renderSeverity toSev
116116 where
117− fromSev DebugS = "Debug"
118− fromSev InfoS = "Info"
119− fromSev NoticeS = "Notice"
120− fromSev WarningS = "Warning"
121− fromSev ErrorS = "Error"
122− fromSev CriticalS = "Critical"
123− fromSev AlertS = "Alert"
124− fromSev EmergencyS = "Emergency"
125117 toSev "Debug" = Right DebugS
126118 toSev "Info" = Right InfoS
127119 toSev "Notice" = Right NoticeS