https://github.com/zhongruoyu/lazyostream
A simple library that wraps C++'s `std::basic_ostream` for lazy evaluation.
https://github.com/zhongruoyu/lazyostream
cpp lazy-evaluation logging
Last synced: 12 months ago
JSON representation
A simple library that wraps C++'s `std::basic_ostream` for lazy evaluation.
- Host: GitHub
- URL: https://github.com/zhongruoyu/lazyostream
- Owner: ZhongRuoyu
- License: mit
- Created: 2022-06-03T14:12:15.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-15T14:09:14.000Z (about 4 years ago)
- Last Synced: 2025-01-06T08:18:08.941Z (over 1 year ago)
- Topics: cpp, lazy-evaluation, logging
- Language: C++
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LazyOstream
This is a simple library that wraps C++'s `std::basic_ostream` for lazy
evaluation. Streams can be disabled, and when they are, output is not
evaluated. This can be achieved without having to rebuild the binary or define
any additional debugging flags, making it very suitable for logging and
debugging purposes.
## Interfaces
It provides a general interface, `LAZY_OSTREAM(ostream, enabled)`. When
`enabled` is set to `true`, it behaves normally like the `ostream` itself;
when `enabled` is set to `false`, however, anything passed to it is not
evaluated. In addition, similar to `iostream`, it also defines the following
three shortcuts for the standard output streams: `LAZY_COUT(enabled)`,
`LAZY_CERR(enabled)`, `LAZY_CLOG(enabled)`.
## Examples
See [here](examples) for a set of examples.
## License
Copyright (c) 2022 Zhong Ruoyu. Licensed under [the MIT License](LICENSE).