Skip to content

Logging: make sure buffering while writing to file is avoided #53

Description

@divanchykhin

By default fwrite() uses internal buffering instead of writing to file directly (as would be reasonable in case of logging). Such buffering means both extra work (performance) and either potential for losing the tails (reliability) or flushing after each write.
A quick solution could be calling setbuf() with buffer set to nullptr (effectively turning buffering off).
Another way is to use posix calls (open(), write(), etc).
On Windows it's reasonable to use win32 api, which is, ultimately, used anyway.

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions