| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | //====================================================================================================================== | ||
| 2 | /* | ||
| 3 | TTS - Tiny Test System | ||
| 4 | Copyright : TTS Contributors & Maintainers | ||
| 5 | SPDX-License-Identifier: BSL-1.0 | ||
| 6 | */ | ||
| 7 | //====================================================================================================================== | ||
| 8 | #pragma once | ||
| 9 | |||
| 10 | #include <tts/engine/environment.hpp> | ||
| 11 | #include <tts/tools/as_text.hpp> | ||
| 12 | |||
| 13 | namespace tts::_ | ||
| 14 | { | ||
| 15 | struct fatal_signal | ||
| 16 | { | ||
| 17 | }; | ||
| 18 | |||
| 19 | struct logger | ||
| 20 | { | ||
| 21 | 1601652 | explicit logger(bool status = true) | |
| 22 | 1601652 | : display(status) | |
| 23 | 1601652 | , done(false) | |
| 24 | { | ||
| 25 | 1601652 | } | |
| 26 | |||
| 27 | 1200000 | template<typename Data> logger& operator<<(Data const& d) | |
| 28 | { | ||
| 29 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 600000 times.
|
1200000 | if(display) |
| 30 | { | ||
| 31 | ✗ | if(!done) | |
| 32 | { | ||
| 33 | ✗ | ::tts::output().write(" >> Additional information: \n "); | |
| 34 | ✗ | done = true; | |
| 35 | } | ||
| 36 | |||
| 37 | ✗ | ::tts::output().write(as_text(d)); | |
| 38 | } | ||
| 39 | 1200000 | return *this; | |
| 40 | } | ||
| 41 | |||
| 42 | 1601652 | ~logger() noexcept(false) | |
| 43 | { | ||
| 44 |
3/5✓ Branch 0 taken 53 times.
✓ Branch 1 taken 1601599 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 53 times.
✗ Branch 7 not taken.
|
1601652 | if(display && done) ::tts::output().writeln(); |
| 45 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1601650 times.
|
1601652 | if(::tts::fatal_error_status) throw ::tts::_::fatal_signal(); |
| 46 | 1601650 | } | |
| 47 | |||
| 48 | bool display, done; | ||
| 49 | }; | ||
| 50 | } | ||
| 51 |