@@ -72,7 +72,7 @@ mkHandleScribe = mkHandleScribeWithFormatter bracketFormat
7272-- Returns the newly-created `Scribe`. The finalizer flushes the
7373-- handle. Handle mode is set to 'LineBuffering' automatically.
7474mkHandleScribeWithFormatter :: (forall a . LogItem a => ItemFormatter a) -> ColorStrategy -> Handle -> Severity -> Verbosity -> IO Scribe
75−mkHandleScribeWithFormatter formatItem cs h sev verb = do
75+mkHandleScribeWithFormatter itemFormatter cs h sev verb = do
7676 hSetBuffering h LineBuffering
7777 colorize <- case cs of
7878 ColorIfTerminal -> hIsTerminalDevice h
@@ -80,7 +80,7 @@ mkHandleScribeWithFormatter formatItem cs h sev verb = do
8080 lock <- newMVar ()
8181 let logger i@Item{..} = do
8282 when (permitItem sev i) $ bracket_ (takeMVar lock) (putMVar lock ()) $
83− T.hPutStrLn h $ toLazyText $ formatItem colorize verb i
83+ T.hPutStrLn h $ toLazyText $ itemFormatter colorize verb i
8484 return $ Scribe logger (hFlush h)
8585
8686
@@ -105,6 +105,11 @@ mkFileScribe f sev verb = do
105105-- See `bracketFormat` and `jsonFormat` for examples.
106106type ItemFormatter a = Bool -> Verbosity -> Item a -> Builder
107107
108+
109+formatItem :: LogItem a => ItemFormatter a
110+formatItem = bracketFormat
111+{-# DEPRECATED formatItem "Use bracketFormat instead" #-}
112+
108113-- | A traditional 'bracketed' log format. Contexts and other information will
109114-- be flattened out into bracketed fields. For example:
110115--
@@ -131,7 +136,7 @@ bracketFormat withColor verb Item{..} =
131136-- | Logs items as JSON. This can be useful in circumstances where you already
132137-- have infrastructure that is expecting JSON to be logged to a standard stream
133138-- or file. For example:
134−
139+--
135140-- > {"at":"2018-10-02T21:50:30.4523848Z","env":"production","ns":["MyApp"],"data":{},"app":["MyApp"],"msg":"Started","pid":"10456","loc":{"loc_col":9,"loc_pkg":"main","loc_mod":"Helpers.Logging","loc_fn":"Helpers\\Logging.hs","loc_ln":44},"host":"myhost.example.com","sev":"Info","thread":"ThreadId 139"}
136141-- > {"at":"2018-10-02T21:50:30.4523848Z","env":"production","ns":["MyApp","confrabulation"],"data":{"confrab_factor":42},"app":["MyApp"],"msg":"Confrabulating widgets, with extra namespace and context","pid":"10456","loc":{"loc_col":11,"loc_pkg":"main","loc_mod":"Helpers.Logging","loc_fn":"Helpers\\Logging.hs","loc_ln":53},"host":"myhost.example.com","sev":"Debug","thread":"ThreadId 139"}
137142-- > {"at":"2018-10-02T21:50:30.4523848Z","env":"production","ns":["MyApp"],"data":{},"app":["MyApp"],"msg":"Namespace and context are back to normal","pid":"10456","loc":{"loc_col":9,"loc_pkg":"main","loc_mod":"Helpers.Logging","loc_fn":"Helpers\\Logging.hs","loc_ln":55},"host":"myhost.example.com","sev":"Info","thread":"ThreadId 139"}