log-warper
log-warper copied to clipboard
Some characters cause crash
- Add following line to any file that use logging:
logWarning $ toText $ map chr [128] - Build, run
Expected: Program not crashes
Actual: Program crashes with play-log: <stderr>: hPutChar: invalid argument (invalid character)
I expect that logging library for no means should be cause of stopping the thread it runs in. Please correct me if I'm wrong about it.
@andrey-komarov I tried to reproduce this issue and played a bit with it. And it seems it works just fine for me:
[node:WARNING] [2017-12-07 09:46:54.41 UTC]
:thinking:
@andrey-komarov @vrom911 Same for me. I added your line just after this one:
https://github.com/serokell/log-warper/blob/5783fde3f8cca225e146d08173584dacfe67ed3b/examples/Playground.hs#L25
And I can see this character in my terminal. I tested with
$ stack exec play-log 2> err.log
$ cat err.log
to make sure that logging is done to stderr.
@andrey-komarov Btw, this might help you:
mapM_ (`hSetEncoding` utf8) [stdin, stdout, stderr]