# Buffer the logging function · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/6fb23542fe8503ba5c97bde950b1ebbe8f07f951)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 6fb23542fe8503ba5c97bde950b1ebbe8f07f951

Requested commit: 6fb23542fe8503ba5c97bde950b1ebbe8f07f951

Commit: 6fb23542fe8503ba5c97bde950b1ebbe8f07f951

Tree: 394f6d549a08d4319c3d78acfb05120b4a114da4

Author: Prokop Randacek

Committer: Andrew Kelley

## Message

```
Buffer the logging function

The default logging function used to have no buffer. So a single log
statement could result in many individual write syscalls each writing
only a couple of bytes.

After this change the logging function now has a 4kb buffer. Only log
statements longer than 4kb now do multiple write syscalls.

4kb is the default bufferedWriter size and was choosen arbitrarily.

The downside of this is that the log function now allocates 4kb more
stack space but I think that is an acceptable trade-off.

```

## Parents

- [731ff120d0ee68f3ce2eb30648eeaf96a283142d](https://git.cafe/gitcafe/zig/commit/731ff120d0ee68f3ce2eb30648eeaf96a283142d?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/6fb23542fe8503ba5c97bde950b1ebbe8f07f951?format=markdown)
