Scroom 0.14-49-gb7ae7a6d
Loading...
Searching...
No Matches
Scroom::LoggerContainer Class Reference

#include <logger.hh>

Collaboration diagram for Scroom::LoggerContainer:
Collaboration graph

Public Types

using Ptr = std::shared_ptr< LoggerContainer >
 

Public Member Functions

 LoggerContainer ()
 
std::shared_ptr< spdlog::logger > get () const
 
void set (std::shared_ptr< spdlog::logger > logger_)
 

Static Public Member Functions

static Ptr instance ()
 

Private Attributes

std::mutex mut
 
std::shared_ptr< spdlog::logger > logger
 

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ LoggerContainer()

Scroom::LoggerContainer::LoggerContainer ( )
17 : logger(std::make_shared<spdlog::logger>("scroom", std::make_shared<spdlog::sinks::stdout_color_sink_mt>()))
18 {
19 }
std::shared_ptr< spdlog::logger > logger
Definition logger.hh:37

Referenced by instance().

Here is the caller graph for this function:

Member Function Documentation

◆ get()

std::shared_ptr< spdlog::logger > Scroom::LoggerContainer::get ( ) const
36 {
37 std::lock_guard const lock(mut);
38 return logger;
39 }
std::mutex mut
Definition logger.hh:36

◆ instance()

LoggerContainer::Ptr Scroom::LoggerContainer::instance ( )
static
22 {
23 static std::mutex mut;
24 static std::weak_ptr<LoggerContainer> instance;
25 std::lock_guard const lock(mut);
26 Ptr result = instance.lock();
27 if(!result)
28 {
29 result = Ptr(new LoggerContainer());
31 }
32 return result;
33 }
static Ptr instance()
Definition logger.cc:21
std::shared_ptr< LoggerContainer > Ptr
Definition logger.hh:33
LoggerContainer()
Definition logger.cc:16
SampleIterator< const uint8_t > result
Definition sampleiterator-tests.cc:94

Referenced by instance(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set()

void Scroom::LoggerContainer::set ( std::shared_ptr< spdlog::logger >  logger_)
42 {
43 std::lock_guard const lock(mut);
44 logger = std::move(logger_);
45 }

Member Data Documentation

◆ logger

std::shared_ptr<spdlog::logger> Scroom::LoggerContainer::logger
private

Referenced by get(), and set().

◆ mut

std::mutex Scroom::LoggerContainer::mut
mutableprivate

Referenced by get(), instance(), and set().


The documentation for this class was generated from the following files: