on master help sign in
Downcase log functions in preparation for monadic
commit17f5bfea1226998bed00ae9db97b143417ef335e authorMichael Xavier <michael@michaelxavier.net> dateThu 12 Mar 2015, 13:18 (12 years ago) parent4d103d8
3 files changed+20−20
katip/examples/Main.hs+3−3 katip/src/Katip.hs+4−4 katip/src/Katip/Core.hs+13−13
katip/examples/Main.hs+3−3
@@ -14,9 +14,9 @@ import Katip.Scribes.Handle
1414
1515main :: IO ()
1616main = runKatipT _ioLogEnv $ do
17− logM "example" InfoS "Easy to emit from IO directly!"
18− logF myContext "example" InfoS "Here's a more stateful item."
19− $(logT) myContext "example" InfoS "Here's one with code location."
17+ logm "example" InfoS "Easy to emit from IO directly!"
18+ logf myContext "example" InfoS "Here's a more stateful item."
19+ $(logt) myContext "example" InfoS "Here's one with code location."
2020
2121
2222
katip/src/Katip.hs+4−4
@@ -26,10 +26,10 @@ module Katip
2626 , LogStr (..)
2727 , logStr, ls, showLS
2828
29− , logF
30− , logM
31− , logT
32− , logI
29+ , logf
30+ , logm
31+ , logt
32+ , logi
3333
3434 -- * Included Scribes
3535 , mkHandleScribe
katip/src/Katip/Core.hs+13−13
@@ -121,7 +121,7 @@ instance Monoid LogStr where
121121 mempty = LogStr mempty
122122
123123-------------------------------------------------------------------------------
124−-- | Pack any string-like thing into a 'LogMsg'. This will
124+-- | Pack any string-like thing into a 'LogStr'. This will
125125-- automatically work on 'String', 'ByteString, 'Text' and any of the
126126-- lazy variants.
127127logStr :: StringConv a Text => a -> LogStr
@@ -129,7 +129,7 @@ logStr t = LogStr (B.fromText $ toS t)
129129
130130
131131-------------------------------------------------------------------------------
132−-- | Shorthand for 'logMsg'
132+-- | Shorthand for 'logm'
133133ls :: StringConv a Text => a -> LogStr
134134ls = logStr
135135
@@ -357,8 +357,8 @@ runKatipT le (KatipT f) = runReaderT f le
357357
358358-------------------------------------------------------------------------------
359359-- | Log with everything, including a source code location. This is
360−-- very low level and you typically can use 'logT' in its place.
361−logI
360+-- very low level and you typically can use 'logt' in its place.
361+logi
362362 :: (Applicative m, LogContext a, Katip m)
363363 => a
364364 -> Namespace
@@ -366,7 +366,7 @@ logI
366366 -> Severity
367367 -> LogStr
368368 -> m ()
369−logI a ns loc sev msg = do
369+logi a ns loc sev msg = do
370370 LogEnv{..} <- getLogEnv
371371 item <- Item
372372 <$> pure _logEnvNs
@@ -385,7 +385,7 @@ logI a ns loc sev msg = do
385385
386386-------------------------------------------------------------------------------
387387-- | Log with full context, but without any code location.
388−logF
388+logf
389389 :: (Applicative m, LogContext a, Katip m)
390390 => a
391391 -- ^ Contextual payload for the log
@@ -396,18 +396,18 @@ logF
396396 -> LogStr
397397 -- ^ The log message
398398 -> m ()
399−logF a ns sev msg = logI a ns Nothing sev msg
399+logf a ns sev msg = logi a ns Nothing sev msg
400400
401401
402402-------------------------------------------------------------------------------
403403-- | Log a message without any payload/context or code location.
404−logM
404+logm
405405 :: (Applicative m, Katip m)
406406 => Namespace
407407 -> Severity
408408 -> LogStr
409409 -> m ()
410−logM ns sev msg = logF () ns sev msg
410+logm ns sev msg = logf () ns sev msg
411411
412412
413413instance TH.Lift Namespace where
@@ -447,7 +447,7 @@ liftLoc (Loc a b c (d1, d2) (e1, e2)) = [|Loc
447447
448448-------------------------------------------------------------------------------
449449-- | For use when you want to include location in your logs. This will
450−-- fill the 'Maybe Loc' gap in 'logF' of this module.
450+-- fill the 'Maybe Loc' gap in 'logf' of this module.
451451getLoc :: Q Exp
452452getLoc = [| $(location >>= liftLoc) |]
453453
@@ -455,9 +455,9 @@ getLoc = [| $(location >>= liftLoc) |]
455455-------------------------------------------------------------------------------
456456-- | 'Loc'-tagged logging when using template-haskell is OK.
457457--
458−-- @$(logT) obj mempty Info "Hello world"@
459−logT :: ExpQ
460−logT = [| \ a ns sev msg -> logI a ns (Just $(getLoc)) sev msg |]
458+-- @$(logt) obj mempty Info "Hello world"@
459+logt :: ExpQ
460+logt = [| \ a ns sev msg -> logi a ns (Just $(getLoc)) sev msg |]
461461
462462
463463-- taken from the file-location package