Skip to content

Commit

Permalink
for issue #80
Browse files Browse the repository at this point in the history
  • Loading branch information
NevilClavain committed Jul 16, 2023
1 parent 3c4d7ac commit 6dcdfe5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 4 additions & 5 deletions CORE_logger/src/logconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void Logger::Configuration::on_new_line( const dsstring& p_line, long p_line_num

SinkEntry sink_entry;

sink_entry.output = Configuration::getInstance()->m_outputs[p_words[4]];
sink_entry.output = Configuration::getInstance()->m_outputs[p_words[4]].get();

if( "on" == p_words[3] )
{
Expand Down Expand Up @@ -128,16 +128,15 @@ void Logger::Configuration::on_new_line( const dsstring& p_line, long p_line_num

if( "file" == p_words[1] )
{
const auto of{ new OutputFile(p_words[3]) };
of->SetFlushPeriod( std::atoi( p_words[4].c_str() ) );
Configuration::getInstance()->m_outputs[p_words[2]] = of;
Configuration::getInstance()->m_outputs[p_words[2]] = std::make_unique<OutputFile>(p_words[3]);
const auto& of{ Configuration::getInstance()->m_outputs[p_words[2]] };
of.get()->SetFlushPeriod(std::atoi(p_words[4].c_str()));
}
else
{
_DSEXCEPTION("log configuration file : unknown class for output, line " + std::to_string(p_line_num));
}
}

}

void Logger::Configuration::registerSink( Sink* p_sink )
Expand Down
12 changes: 6 additions & 6 deletions CORE_logger/src/logconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ namespace DrawSpace
Sink::Level level;
Output* output;
};

std::map<dsstring, std::unique_ptr<Output>> m_outputs;
std::map<dsstring, SinkEntry> m_sinks;

std::map<dsstring, Output*> m_outputs;
std::map<dsstring, SinkEntry> m_sinks;

LARGE_INTEGER m_base_tick;
LARGE_INTEGER m_last_tick;
LARGE_INTEGER m_freq;
LARGE_INTEGER m_base_tick;
LARGE_INTEGER m_last_tick;
LARGE_INTEGER m_freq;

static void on_new_line(const dsstring& p_line, long p_line_num, const std::vector<dsstring>& p_words);
};
Expand Down

0 comments on commit 6dcdfe5

Please sign in to comment.