Skip to content

Commit 0023e89

Browse files
committed
Fix iostream fmt
1 parent 595fe66 commit 0023e89

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

captbackend/Core/Log.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
#include "Log.hpp"
22

33
namespace Log {
4-
StreamTerminator::StreamTerminator(std::ostream& stream) noexcept : stream(stream) {}
4+
StreamTerminator::StreamTerminator(std::ostream& stream) noexcept
5+
: stream(stream) {
6+
this->state.copyfmt(stream);
7+
}
58

6-
StreamTerminator::StreamTerminator(StreamTerminator&& other) noexcept : stream(other.stream) {
9+
StreamTerminator::StreamTerminator(StreamTerminator&& other) noexcept
10+
: stream(other.stream) {
11+
this->state.copyfmt(other.state);
712
other.terminate = false;
813
}
914

1015
StreamTerminator::~StreamTerminator() {
1116
if (this->terminate) {
1217
this->stream << std::endl;
18+
this->stream.copyfmt(this->state);
1319
}
1420
}
1521

captbackend/Core/Log.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ namespace Log {
77
private:
88
std::ostream& stream;
99
bool terminate = true;
10+
11+
std::ios state = std::ios(nullptr);
1012
public:
1113
explicit StreamTerminator(std::ostream& stream) noexcept;
1214
~StreamTerminator();

0 commit comments

Comments
 (0)