New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When I log a message longer than 8160 characters, fast-logger just logs a newline #80

Merged
merged 3 commits into from Apr 4, 2016

Conversation

Projects
None yet
3 participants
@nh2
Contributor

nh2 commented Mar 29, 2016

import qualified Data.Text as T
import           System.Log.FastLogger

main :: IO ()
main = do
  set <- newStderrLoggerSet defaultBufSize
  let text = T.pack $ replicate 8161 'x'
  pushLogStrLn set (toLogStr text)

Expected output: lots of xs

Actual output: (enclused in 2 horizontal bars for better visibility)




Fix attached (props to @exFalso and @chpatrick for helping), and a test.

Independent of this, I also noticed that when logging that string, in toBufIOWith there comes around a Done with len == 0 as the first thing before the real data comes; I didn't look into why that is.

chpatrick and others added some commits Mar 29, 2016

fast-logger: Fix long strings being printed as empty string.
Until now, this program printed only a newline (output should be
lots of "xxxx..."):

    import qualified Data.Text as T
    import           System.Log.FastLogger

    main :: IO ()
    main = do
      set <- newStderrLoggerSet defaultBufSize
      let text = T.pack $ replicate 8161 'x'
      pushLogStrLn set (toLogStr text)

In `(len, next) <- BBE.runBuilder`, `len == 0` doens't mean that there's
nothing to write; it means that no string has has been rendered into the
provided buffer, because the string was already fully present in memory
as a ByteString (this ByteString is contained in `next`).

That ByteString still has to be written out.

Thanks to Andras Slemmer (@exFalso) for help tracking this down.

@kazu-yamamoto kazu-yamamoto merged commit a4aba3c into kazu-yamamoto:master Apr 4, 2016

1 check failed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
@kazu-yamamoto

This comment has been minimized.

Show comment
Hide comment
@kazu-yamamoto

kazu-yamamoto Apr 4, 2016

Owner

I have merged this pull request. Thank you very much.

Please register the issue above as a new issue.

Owner

kazu-yamamoto commented Apr 4, 2016

I have merged this pull request. Thank you very much.

Please register the issue above as a new issue.

@kazu-yamamoto

This comment has been minimized.

Show comment
Hide comment
@kazu-yamamoto

kazu-yamamoto Apr 5, 2016

Owner

A new version has been released.

Owner

kazu-yamamoto commented Apr 5, 2016

A new version has been released.

@nh2

This comment has been minimized.

Show comment
Hide comment
@nh2

nh2 Apr 5, 2016

Contributor

Thanks you!

Contributor

nh2 commented Apr 5, 2016

Thanks you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment