diff options
author | Anton Samokhvalov <pg83@yandex.ru> | 2022-02-10 16:45:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:15 +0300 |
commit | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (patch) | |
tree | da2c34829458c7d4e74bdfbdf85dff449e9e7fb8 /util/stream/debug.cpp | |
parent | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (diff) | |
download | ydb-72cb13b4aff9bc9cf22e49251bc8fd143f82538f.tar.gz |
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 1 of 2.
Diffstat (limited to 'util/stream/debug.cpp')
-rw-r--r-- | util/stream/debug.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/util/stream/debug.cpp b/util/stream/debug.cpp index afd5b3e1c7..35c43331ac 100644 --- a/util/stream/debug.cpp +++ b/util/stream/debug.cpp @@ -1,49 +1,49 @@ -#include "null.h" -#include "debug.h" - -#include <util/string/cast.h> -#include <util/generic/singleton.h> -#include <util/generic/yexception.h> - -#include <cstdio> -#include <cstdlib> - -void TDebugOutput::DoWrite(const void* buf, size_t len) { - if (len != fwrite(buf, 1, len, stderr)) { +#include "null.h" +#include "debug.h" + +#include <util/string/cast.h> +#include <util/generic/singleton.h> +#include <util/generic/yexception.h> + +#include <cstdio> +#include <cstdlib> + +void TDebugOutput::DoWrite(const void* buf, size_t len) { + if (len != fwrite(buf, 1, len, stderr)) { ythrow yexception() << "write failed(" << LastSystemErrorText() << ")"; - } -} - -namespace { - struct TDbgSelector { - inline TDbgSelector() { - char* dbg = getenv("DBGOUT"); - if (dbg) { - Out = &Cerr; - try { - Level = FromString(dbg); - } catch (const yexception&) { - Level = 0; - } - } else { - Out = &Cnull; + } +} + +namespace { + struct TDbgSelector { + inline TDbgSelector() { + char* dbg = getenv("DBGOUT"); + if (dbg) { + Out = &Cerr; + try { + Level = FromString(dbg); + } catch (const yexception&) { + Level = 0; + } + } else { + Out = &Cnull; Level = 0; } } IOutputStream* Out; - int Level; - }; -} - + int Level; + }; +} + template <> struct TSingletonTraits<TDbgSelector> { static constexpr size_t Priority = 8; }; IOutputStream& StdDbgStream() noexcept { - return *(Singleton<TDbgSelector>()->Out); -} + return *(Singleton<TDbgSelector>()->Out); +} int StdDbgLevel() noexcept { return Singleton<TDbgSelector>()->Level; |