File: Helper.hs

package info (click to toggle)
haskell-logging-facade 0.3.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 84 kB
  • sloc: haskell: 204; makefile: 3
file content (17 lines) | stat: -rw-r--r-- 412 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
module Helper (
  module Test.Hspec
, logSinkSpy
) where

import           Test.Hspec
import           Data.IORef

import           System.Logging.Facade.Types
import           System.Logging.Facade.Sink

logSinkSpy :: IO (IO [LogRecord], LogSink)
logSinkSpy = do
  ref <- newIORef []
  let spy :: LogSink
      spy record = modifyIORef ref (record {logRecordLocation = Nothing} :)
  return (readIORef ref, spy)