[env_logger] Adds a newline to format string before writing #219

Closed
tailhook wants to merge 1 commit from atomic_newline into master
tailhook commented 2017-08-14 05:32:10 -05:00 (Migrated from github.com)

This is important so in unix systems most of the time buffer is output
atomically (until certain length of message). Which means you don't get
two lines squashed together if they are written simultaneously.

I believe most of the time it's doesn't influence performance, because
underlying buffer of string is probably overallocated a bit anyway.

This is important so in unix systems most of the time buffer is output atomically (until certain length of message). Which means you don't get two lines squashed together if they are written simultaneously. I believe most of the time it's doesn't influence performance, because underlying buffer of string is probably overallocated a bit anyway.
sfackler commented 2017-08-14 22:52:42 -05:00 (Migrated from github.com)

Stdout is line buffered - when will this change behavior?

Stdout is line buffered - when will this change behavior?
tailhook commented 2017-08-15 01:07:25 -05:00 (Migrated from github.com)

Stdout is line buffered - when will this change behavior?

Is it? I observe broken logs every time I start two processes. Logs are written to stderr by default, though. Is there any difference between stdout and stderr?

> Stdout is line buffered - when will this change behavior? Is it? I observe broken logs every time I start two processes. Logs are written to stderr by default, though. Is there any difference between stdout and stderr?
tailhook commented 2017-08-15 01:14:53 -05:00 (Migrated from github.com)

Well, it looks like undocumented, but yes, stdout is line buffered whereas stderr isn't. So we could revert to the old behavior on stdout.

Well, it looks like undocumented, but yes, stdout is line buffered whereas stderr isn't. So we could revert to the old behavior on stdout.
tailhook commented 2017-08-15 01:23:54 -05:00 (Migrated from github.com)

Done. Also fixed bug. (I used to think that it's enough to run tests in root directory rather than env)

Done. Also fixed bug. (I used to think that it's enough to run tests in root directory rather than `env`)
KodrAus commented 2017-09-17 16:09:52 -05:00 (Migrated from github.com)

Thanks for this @tailhook! Do you mind rebasing this over at https://github.com/sebasmagri/env_logger, which is the new home for env_logger?

Thanks for this @tailhook! Do you mind rebasing this over at https://github.com/sebasmagri/env_logger, which is the new home for `env_logger`?
tailhook commented 2017-09-17 16:37:48 -05:00 (Migrated from github.com)

Well, it's not so useful after: https://github.com/sebasmagri/env_logger/pull/19

I'm not sure what to do:

  1. Now this behavior depends on actual formatter. Default one is wrong at this respect, and also a bad example to do.
  2. On the other hand, if default formatter fixed it makes the aformentioned PR useless?
Well, it's not so useful after: https://github.com/sebasmagri/env_logger/pull/19 I'm not sure what to do: 1. Now this behavior depends on actual formatter. Default one is wrong at this respect, and also a bad example to do. 2. On the other hand, if default formatter fixed it makes the aformentioned PR useless?
KodrAus commented 2017-09-22 06:44:11 -05:00 (Migrated from github.com)

We've started discussing this over in https://github.com/sebasmagri/env_logger/issues/22 so I'll close this PR now. I'd definitely like to come up with a good solution to this before a 1.0 of env_logger!

We've started discussing this over in https://github.com/sebasmagri/env_logger/issues/22 so I'll close this PR now. I'd definitely like to come up with a good solution to this before a `1.0` of `env_logger`!

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-rust-lang/log!219
No description provided.