Fix FileLog under UWP.
GitOrigin-RevId: 4e3f01195c9980922f05e5b92f3b8eea940bdbf8
This commit is contained in:
parent
02e83aad78
commit
0e7fdac841
@ -31,7 +31,9 @@ bool FileLog::init(string path, int64 rotate_threshold) {
|
||||
|
||||
fd_.close();
|
||||
fd_ = r_fd.move_as_ok();
|
||||
fd_.get_native_fd().duplicate(Stderr().get_native_fd()).ignore();
|
||||
if (!Stderr().empty()) {
|
||||
fd_.get_native_fd().duplicate(Stderr().get_native_fd()).ignore();
|
||||
}
|
||||
|
||||
path_ = std::move(path);
|
||||
size_ = fd_.get_size();
|
||||
@ -84,7 +86,9 @@ void FileLog::do_rotate() {
|
||||
process_fatal_error(r_fd.error().message());
|
||||
}
|
||||
fd_ = r_fd.move_as_ok();
|
||||
fd_.get_native_fd().duplicate(Stderr().get_native_fd()).ignore();
|
||||
if (!Stderr().empty()) {
|
||||
fd_.get_native_fd().duplicate(Stderr().get_native_fd()).ignore();
|
||||
}
|
||||
size_ = 0;
|
||||
SET_VERBOSITY_LEVEL(current_verbosity_level);
|
||||
}
|
||||
|
Reference in New Issue
Block a user