mirror of
https://github.com/NixOS/nix.git
synced 2025-11-16 15:32:43 +01:00
refactor: RAII logger suspension
(cherry picked from commit 30694b5d8a)
This commit is contained in:
parent
375df6c086
commit
ac3fc8876c
7 changed files with 46 additions and 35 deletions
|
|
@ -4,6 +4,7 @@
|
|||
#include "error.hh"
|
||||
#include "config.hh"
|
||||
#include "file-descriptor.hh"
|
||||
#include "finally.hh"
|
||||
|
||||
#include <nlohmann/json_fwd.hpp>
|
||||
|
||||
|
|
@ -75,6 +76,17 @@ public:
|
|||
|
||||
virtual void stop() { };
|
||||
|
||||
/**
|
||||
* Guard object to resume the logger when done.
|
||||
*/
|
||||
struct Suspension {
|
||||
Finally<std::function<void()>> _finalize;
|
||||
};
|
||||
|
||||
Suspension suspend();
|
||||
|
||||
std::optional<Suspension> suspendIf(bool cond);
|
||||
|
||||
virtual void pause() { };
|
||||
virtual void resume() { };
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue