serokell / log-warper

Logging library to provide more convenient, extremely configurable but simple monadic interface with pretty output
MIT License
19 stars 11 forks source link

Some characters cause crash #69

Open andrey-komarov opened 6 years ago

andrey-komarov commented 6 years ago

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.

vrom911 commented 6 years ago

@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:

chshersh commented 6 years ago

@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.

chshersh commented 6 years ago

@andrey-komarov Btw, this might help you:

mapM_ (`hSetEncoding` utf8) [stdin, stdout, stderr]