diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-25 17:56:21 +0000 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2016-02-25 17:56:21 +0000 |
commit | 4d7ecb10ada3115da14fb7baefe9cb1b510bb6ae (patch) | |
tree | b46b2b22ee73d76f419d87a23294d8d982346eb7 /server/src | |
parent | f515803694d7f8430b064f16a5a923b09ba70650 (diff) | |
download | thermoprint-4d7ecb10ada3115da14fb7baefe9cb1b510bb6ae.tar thermoprint-4d7ecb10ada3115da14fb7baefe9cb1b510bb6ae.tar.gz thermoprint-4d7ecb10ada3115da14fb7baefe9cb1b510bb6ae.tar.bz2 thermoprint-4d7ecb10ada3115da14fb7baefe9cb1b510bb6ae.tar.xz thermoprint-4d7ecb10ada3115da14fb7baefe9cb1b510bb6ae.zip |
delayed debugging printer
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/Thermoprint/Server/Printer/Debug/Delayed.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/src/Thermoprint/Server/Printer/Debug/Delayed.hs b/server/src/Thermoprint/Server/Printer/Debug/Delayed.hs new file mode 100644 index 0000000..c002d43 --- /dev/null +++ b/server/src/Thermoprint/Server/Printer/Debug/Delayed.hs | |||
@@ -0,0 +1,16 @@ | |||
1 | -- | A printer which blocks for a certain time and writes to log | ||
2 | module Thermoprint.Server.Printer.Debug.Delayed | ||
3 | ( delayedDebugPrint | ||
4 | ) where | ||
5 | |||
6 | import Control.Monad.IO.Class | ||
7 | import Control.Applicative | ||
8 | |||
9 | import Control.Concurrent (threadDelay) | ||
10 | |||
11 | import Thermoprint.Server.Printer | ||
12 | import Thermoprint.Server.Printer.Debug | ||
13 | |||
14 | delayedDebugPrint :: Int -> PrinterMethod | ||
15 | -- ^ Wait the given number of microseconds before invoking 'debugPrint' | ||
16 | delayedDebugPrint wait = PM $ \po -> let (PM debugPrint') = debugPrint in liftIO (threadDelay wait) *> debugPrint' po | ||