Skip to content

Commit

Permalink
Fix startup
Browse files Browse the repository at this point in the history
  • Loading branch information
sgallou committed Sep 3, 2024
1 parent 8f53029 commit 1cb325b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 23 deletions.
3 changes: 2 additions & 1 deletion sources/server/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ void CYadomsServer::initialize(Application& self)
current_path(workingDir.parent_path());

m_pathProvider = boost::make_shared<CPathProvider>(m_startupOptions);
logging::CLogConfiguration::configure(m_startupOptions->getLogLevel(), m_pathProvider->logsPath());
m_logConfiguration = boost::make_shared<logging::CLogConfiguration>(m_startupOptions->getLogLevel(),
m_pathProvider->logsPath());

//define proxy settings as earlier possible
setupProxy();
Expand Down
6 changes: 6 additions & 0 deletions sources/server/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "startupOptions/StartupOptions.h"
#include "IRunningInformation.h"
#include "IPathProvider.h"
#include "logging/LogConfiguration.h"


//-----------------------------
Expand Down Expand Up @@ -52,4 +53,9 @@ class CYadomsServer final : public Poco::Util::ServerApplication
///\brief Running information
//-----------------------------
boost::shared_ptr<IRunningInformation> m_runningInformation;

//-----------------------------
///\brief Log configuration
//-----------------------------
boost::shared_ptr<logging::CLogConfiguration> m_logConfiguration;
};
10 changes: 3 additions & 7 deletions sources/server/logging/LogConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@

namespace logging
{
//declare static PImpl configurator
boost::shared_ptr<CLogConfigurationImpl> CLogConfiguration::m_configurator(boost::make_shared<CLogConfigurationImpl>());

void CLogConfiguration::configure(const std::string& logLevel,
const boost::filesystem::path& logPath)
CLogConfiguration::CLogConfiguration(const std::string& logLevel,
const boost::filesystem::path& logPath)
: m_configurator(boost::make_shared<CLogConfigurationImpl>())
{
m_configurator->configure(logLevel,
logPath);
}
} // namespace logging


20 changes: 5 additions & 15 deletions sources/server/logging/LogConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,14 @@ namespace logging
//--------------------------------------------------------------
/// \brief Class used to configure the logger
//--------------------------------------------------------------
class CLogConfiguration
class CLogConfiguration final
{
public:

//--------------------------------------------------------------
/// \brief configure the logger with one file per thread without rolling on size
/// \param[in] logLevel The log level
/// \param[in] logPath The log path
//--------------------------------------------------------------
static void configure(const std::string& logLevel,
const boost::filesystem::path& logPath);
explicit CLogConfiguration(const std::string& logLevel,
const boost::filesystem::path& logPath);
~CLogConfiguration() = default;

private:
//--------------------------------------------------------------
/// \brief Private impelmentation
//--------------------------------------------------------------
static boost::shared_ptr<CLogConfigurationImpl> m_configurator;
boost::shared_ptr<CLogConfigurationImpl> m_configurator;
};
} // namespace logging


0 comments on commit 1cb325b

Please sign in to comment.