add NullLogger
This commit is contained in:
parent
e6d9d2205d
commit
32fc72824b
@ -17,6 +17,7 @@ target_sources(nf7_core
|
|||||||
luajit/lambda.hh
|
luajit/lambda.hh
|
||||||
luajit/thread.hh
|
luajit/thread.hh
|
||||||
clock.hh
|
clock.hh
|
||||||
|
logger.hh
|
||||||
version.hh
|
version.hh
|
||||||
)
|
)
|
||||||
|
|
||||||
|
29
core/logger.hh
Normal file
29
core/logger.hh
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// No copyright
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "iface/common/exception.hh"
|
||||||
|
#include "iface/subsys/logger.hh"
|
||||||
|
|
||||||
|
|
||||||
|
namespace nf7::core {
|
||||||
|
|
||||||
|
class NullLogger : public subsys::Logger {
|
||||||
|
public:
|
||||||
|
static const std::shared_ptr<NullLogger>& instance()
|
||||||
|
try {
|
||||||
|
static const auto kInstance = std::make_shared<NullLogger>();
|
||||||
|
return kInstance;
|
||||||
|
} catch (const std::bad_alloc&) {
|
||||||
|
throw Exception {"memory shortage"};
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
NullLogger() noexcept : subsys::Logger("nf7::core::NullLogger") { }
|
||||||
|
|
||||||
|
public:
|
||||||
|
void Push(const Item&) noexcept override { }
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace nf7::core
|
Loading…
x
Reference in New Issue
Block a user