log-warper 1.2.2 → 1.2.3
raw patch · 3 files changed
+8/−1 lines, 3 files
Files
- CHANGES.md +4/−0
- log-warper.cabal +1/−1
- src/System/Wlog/Handler/Simple.hs +3/−0
CHANGES.md view
@@ -1,3 +1,7 @@+1.2.3+=====++* Now we create a directory for log files if it's missing. 1.2.2 =====
log-warper.cabal view
@@ -1,5 +1,5 @@ name: log-warper-version: 1.2.2+version: 1.2.3 synopsis: Flexible, configurable, monadic and pretty logging homepage: https://github.com/serokell/log-warper license: MIT
src/System/Wlog/Handler/Simple.hs view
@@ -27,6 +27,8 @@ import Control.Exception (SomeException) import qualified Data.Text.IO as TIO import Data.Typeable (Typeable)+import System.Directory (createDirectoryIfMissing)+import System.FilePath (takeDirectory) import System.IO (Handle, IOMode (ReadWriteMode), SeekMode (SeekFromEnd), hClose, hFlush, hSeek) import Universum@@ -98,6 +100,7 @@ -- Append mode. Calling 'close' on the handler will close the file. fileHandler :: FilePath -> Severity -> IO (GenericHandler Handle) fileHandler fp sev = do+ createDirectoryIfMissing True (takeDirectory fp) h <- openFile fp ReadWriteMode hSeek h SeekFromEnd 0 sh <- streamHandler h sev