hslogger 1.3.1.0 → 1.3.1.1
raw patch · 3 files changed
+48/−29 lines, 3 filesdep −ghc-primdep ~basedep ~networkdep ~timenew-uploader
Dependencies removed: ghc-prim
Dependency ranges changed: base, network, time
Files
- CHANGELOG.md +6/−1
- hslogger.cabal +24/−16
- src/System/Log/Logger.hs +18/−12
CHANGELOG.md view
@@ -1,6 +1,11 @@ See also https://pvp.haskell.org/faq -#### 1.3.1.0 *(minor)*+#### 1.3.1.1 *(patch)*++- Drop support for GHC 7+- Tested with GHC 8.0 - 9.10++### 1.3.1.0 *(minor)* - Evaluate message before taking lock in simple handler ([#49](https://github.com/haskell-hvr/hslogger/pull/49)) - Define `Typeable`, `Data`, `Generic` and `NFData` instances for `System.Log.Priority` ([#43](https://github.com/haskell-hvr/hslogger/pull/43))
hslogger.cabal view
@@ -1,16 +1,16 @@ cabal-version: 1.12 build-type: Simple name: hslogger-version: 1.3.1.0+version: 1.3.1.1 -maintainer: hvr@gnu.org+maintainer: https://github.com/haskell-hvr/hslogger author: John Goerzen copyright: Copyright (c) 2004-2018 John Goerzen , (c) 2019 Herbert Valerio Riedel license: BSD3 license-file: LICENSE-homepage: https://github.com/hvr/hslogger/wiki-bug-reports: https://github.com/hvr/hslogger/issues+homepage: https://github.com/haskell-hvr/hslogger/wiki+bug-reports: https://github.com/haskell-hvr/hslogger/issues category: Interfaces synopsis: Versatile logging framework description:@@ -35,11 +35,22 @@ testsrc/runtests.hs tested-with:- GHC ==7.0.4 || ==7.2.2 || ==7.4.2 || ==7.6.3 || ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.4+ GHC == 9.10.0+ GHC == 9.8.2+ GHC == 9.6.4+ GHC == 9.4.8+ GHC == 9.2.8+ GHC == 9.0.2+ GHC == 8.10.7+ GHC == 8.8.4+ GHC == 8.6.5+ GHC == 8.4.4+ GHC == 8.2.2+ GHC == 8.0.2 source-repository head type: git- location: http://github.com/hvr/hslogger.git+ location: http://github.com/haskell-hvr/hslogger.git flag network--GT-3_0_0 description: [network](http://hackage.haskell.org/package/network) ≥ 3.0.0@@ -64,24 +75,21 @@ other-extensions: CPP ExistentialQuantification DeriveDataTypeable build-depends:- base >= 4.3 && < 4.14- , bytestring >= 0.9 && < 0.11- , containers >= 0.4 && < 0.7- , deepseq >= 1.1 && < 1.5- , time >= 1.2 && < 1.10+ base >= 4.9 && < 5+ , bytestring >= 0.9 && < 0.13+ , containers >= 0.4 && < 0.8+ , deepseq >= 1.1 && < 1.6+ , time >= 1.2 && < 1.15 , old-locale >= 1.0 && < 1.1 if flag(network--GT-3_0_0) build-depends: network-bsd >= 2.8.1 && <2.9,- network >= 3.0 && <3.2+ network >= 3.0 && <3.3 else build-depends: network >= 2.6 && <2.9 if !os(windows)- Build-Depends: unix >= 2.4.2 && < 2.8-- if !impl(ghc >= 7.6)- build-depends: ghc-prim+ Build-Depends: unix >= 2.4.2 && < 2.9 test-suite runtests type: exitcode-stdio-1.0
src/System/Log/Logger.hs view
@@ -96,14 +96,19 @@ > -- "MyApp.Component" is an arbitrary string; you can tune > -- logging behavior based on it later. > main = do-> debugM "MyApp.Component" "This is a debug message -- never to be seen"-> warningM "MyApp.Component2" "Something Bad is about to happen."+> logger1 <- getLogger "MyApp.Component"+> logger2 <- getLogger "MyApp.Component2"+> loggerB <- getLogger "MyApp.BuggyComponent"+> loggerW <- getLogger "MyApp.WorkingComponent" >+> logL logger1 DEBUG "This is a debug message -- never to be seen"+> logL logger2 WARNING "Something Bad is about to happen."+> > -- Copy everything to syslog from here on out. > s <- openlog "SyslogStuff" [PID] USER DEBUG-> updateGlobalLogger rootLoggerName (addHandler s)+> saveGlobalLogger =<< addHandler s <$> getRootLogger >-> errorM "MyApp.Component" "This is going to stderr and syslog."+> logL logger1 ERROR "This is going to stderr and syslog." > > -- Now we'd like to see everything from BuggyComponent > -- at DEBUG or higher go to syslog and stderr.@@ -112,17 +117,17 @@ > -- > -- So, we adjust the Logger for MyApp.BuggyComponent. >-> updateGlobalLogger "MyApp.BuggyComponent"-> (setLevel DEBUG)+> let loggerB' = setLevel DEBUG loggerB+> saveGlobalLogger loggerB' > > -- This message will go to syslog and stderr-> debugM "MyApp.BuggyComponent" "This buggy component is buggy"+> logL loggerB' DEBUG "This buggy component is buggy" > > -- This message will go to syslog and stderr too.-> warningM "MyApp.BuggyComponent" "Still Buggy"+> logL loggerB' WARNING "Still Buggy" > > -- This message goes nowhere.-> debugM "MyApp.WorkingComponent" "Hello"+> logL loggerW DEBUG "Hello" > > -- Now we decide we'd also like to log everything from BuggyComponent at DEBUG > -- or higher to a file for later diagnostics. We'd also like to customize the@@ -130,12 +135,13 @@ > > h <- fileHandler "debug.log" DEBUG >>= \lh -> return $ > setFormatter lh (simpleLogFormatter "[$time : $loggername : $prio] $msg")-> updateGlobalLogger "MyApp.BuggyComponent" (addHandler h)+> let loggerB'' = addHandler h loggerB'+> saveGlobalLogger loggerB'' > > -- This message will go to syslog and stderr, > -- and to the file "debug.log" with a format like : > -- [2010-05-23 16:47:28 : MyApp.BuggyComponent : DEBUG] Some useful diagnostics...-> debugM "MyApp.BuggyComponent" "Some useful diagnostics..."+> logL loggerB'' DEBUG "Some useful diagnostics..." > > -}@@ -472,7 +478,7 @@ do l <- getLogger ln saveGlobalLogger (func l) --- | Allow graceful shutdown. Release all opened files/handlers/etc.+-- | Allow graceful shutdown. Release all opened files, handlers, etc. removeAllHandlers :: IO () removeAllHandlers = modifyMVar_ logTree $ \lt -> do