packages feed

logging 2.1.0 → 2.2.0

raw patch · 2 files changed

+9/−50 lines, 2 filesdep −vector-spacedep ~fast-loggerdep ~monad-logger

Dependencies removed: vector-space

Dependency ranges changed: fast-logger, monad-logger

Files

Control/Logging.hs view
@@ -1,6 +1,5 @@-{-# LANGUAGE RankNTypes #-}- {-# OPTIONS_GHC -Wall -fno-warn-orphans #-}+{-# LANGUAGE CPP #-}  -- | Quick example of how to use this module: --@@ -53,13 +52,9 @@     , timedDebugEndS     , timedDebugEndS'     , withStdoutLogging-    , withStdoutLoggingUsing     , withStderrLogging-    , withStderrLoggingUsing     , withFileLogging-    , withFileLoggingUsing     , flushLog-    , LoggingLogger     , loggingLogger     , setLogLevel     , setLogTimeFormat@@ -81,7 +76,11 @@ import Debug.Trace import Prelude hiding (log) import System.IO.Unsafe+#if MIN_VERSION_time (1,5,0)+import System.Locale hiding (defaultTimeLocale)+#else import System.Locale+#endif import System.Log.FastLogger import Text.Regex.PCRE.Light @@ -122,9 +121,6 @@         . encodeUtf8         . T.pack -newtype LoggingLogger = LoggingLogger-  { getLoggingLogger :: ToLogStr msg => Loc -> LogSource -> LogLevel -> msg -> IO () }- -- | This function is used to implement 'monadLoggerLog' for the IO instance. --   You may reuse it if you wish, or it can be passed as an argument to --   'runLoggingT' -- in which case you must remember to call 'flushLog'@@ -159,64 +155,30 @@     renderLevel LevelError = "[ERROR]"     renderLevel (LevelOther txt) = "[" ++ unpack txt ++ "]" -logFunction :: IORef LoggingLogger-{-# NOINLINE logFunction #-}-logFunction = unsafePerformIO $ newIORef (LoggingLogger loggingLogger)- -- | This function, or 'withStderrLogging', must be wrapped around whatever --   region of your application intends to use logging.  Typically it would be --   wrapped around the body of 'main'. withStdoutLogging :: (MonadBaseControl IO m, MonadIO m) => m a -> m a withStdoutLogging f = do     liftIO $ do-        writeIORef logFunction (LoggingLogger loggingLogger)         set <- newStdoutLoggerSet defaultBufSize         atomicWriteIORef logSet set     f `finally` flushLog -withStdoutLoggingUsing :: (MonadBaseControl IO m, MonadIO m)-                       => LoggingLogger -> m a -> m a-withStdoutLoggingUsing logf f = do-    liftIO $ do-        writeIORef logFunction logf-        set <- newStdoutLoggerSet defaultBufSize-        atomicWriteIORef logSet set-    f `finally` flushLog- withStderrLogging :: (MonadBaseControl IO m, MonadIO m) => m a -> m a withStderrLogging f = do     liftIO $ do-        writeIORef logFunction (LoggingLogger loggingLogger)         set <- newStderrLoggerSet defaultBufSize         atomicWriteIORef logSet set     f `finally` flushLog -withStderrLoggingUsing :: (MonadBaseControl IO m, MonadIO m)-                       => LoggingLogger -> m a -> m a-withStderrLoggingUsing logf f = do-    liftIO $ do-        writeIORef logFunction logf-        set <- newStderrLoggerSet defaultBufSize-        atomicWriteIORef logSet set-    f `finally` flushLog- withFileLogging :: (MonadBaseControl IO m, MonadIO m) => FilePath -> m a -> m a withFileLogging path f = do     liftIO $ do-        writeIORef logFunction (LoggingLogger loggingLogger)         set <- newFileLoggerSet defaultBufSize path         atomicWriteIORef logSet set     f `finally` flushLog -withFileLoggingUsing :: (MonadBaseControl IO m, MonadIO m)-                     => LoggingLogger -> FilePath -> m a -> m a-withFileLoggingUsing logf path f = do-    liftIO $ do-        writeIORef logFunction logf-        set <- newFileLoggerSet defaultBufSize path-        atomicWriteIORef logSet set-    f `finally` flushLog- -- | Flush all collected logging messages.  This is automatically called by --   'withStdoutLogging' and 'withStderrLogging' when those blocks are exited --   by whatever means.@@ -226,9 +188,7 @@     flushLogStr set  instance MonadLogger IO where-    monadLoggerLog a b c d = do-        logf <- readIORef logFunction-        getLoggingLogger logf a b c d+    monadLoggerLog = loggingLogger  -- | Synonym for 'Control.Monad.Logger.logInfoN'.  This module provides a --   'MonadLogger' instance for IO, so this function can be used directly in
logging.cabal view
@@ -1,5 +1,5 @@ Name:                logging-Version:             2.1.0+Version:             2.2.0 Synopsis:            Simplified logging in IO for application writers. License-file:        LICENSE License:             MIT@@ -44,15 +44,14 @@         base                 >= 3 && < 5       , binary               >= 0.5.1.1       , bytestring           >= 0.9.2.1-      , fast-logger          >= 2.2.0+      , fast-logger          >= 2.1.5       , old-locale           >= 1.0.0.5       , time                 >= 1.4       , monad-control        >= 0.3.2.3-      , monad-logger         >= 0.3.7.1+      , monad-logger         >= 0.3.4.0       , text                 >= 0.11.3.1       , transformers         >= 0.3.0.0       , lifted-base          >= 0.2.2.0-      , vector-space         >= 0.8.6       , pcre-light           >= 0.4     exposed-modules:         Control.Logging