From 18ecd62eb79ba08e4336c71321693410ebb8bd4c Mon Sep 17 00:00:00 2001 From: Andrey Astafyev Date: Mon, 21 Oct 2019 20:35:50 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=BE=D1=80=D0=BC=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=B4?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/myx/filesystem/paths.cpp | 26 +++++++++++++------------- src/myx/filesystem/paths.hpp | 18 +++++++++--------- src/myx/filesystem/whereami.cpp | 10 +++++----- src/myx/filesystem/whereami.hpp | 2 +- src/myx/log/spdlog.cpp | 30 +++++++++++++++--------------- src/myx/log/spdlog.hpp | 26 +++++++++++++------------- src/myx/log/spdlog_qt.cpp | 2 +- 7 files changed, 57 insertions(+), 57 deletions(-) diff --git a/src/myx/filesystem/paths.cpp b/src/myx/filesystem/paths.cpp index de974f9..6929745 100644 --- a/src/myx/filesystem/paths.cpp +++ b/src/myx/filesystem/paths.cpp @@ -63,16 +63,16 @@ Paths::Paths() { m_prefixDirectory = "/opt/" + QCoreApplication::organizationName().toLower() + "/" + QCoreApplication::applicationName().toLower(); - m_binaryDirectory = m_prefixDirectory.absolutePath() + "/bin"; - m_configDirectory = m_prefixDirectory.absolutePath() + "/etc"; - m_cacheDirectory = m_prefixDirectory.absolutePath() + "/var"; - m_tempDirectory = QString::fromLocal8Bit( qgetenv( qPrintable( "TMPDIR" ) ) ); - m_dataDirectory = m_prefixDirectory.absolutePath() + "/share"; - m_homeDirectory = QString::fromLocal8Bit( qgetenv( qPrintable( "HOME" ) ) ); + m_binaryDirectory = m_prefixDirectory.absolutePath() + "/bin"; + m_configDirectory = m_prefixDirectory.absolutePath() + "/etc"; + m_cacheDirectory = m_prefixDirectory.absolutePath() + "/var"; + m_tempDirectory = QString::fromLocal8Bit( qgetenv( qPrintable( "TMPDIR" ) ) ); + m_dataDirectory = m_prefixDirectory.absolutePath() + "/share"; + m_homeDirectory = QString::fromLocal8Bit( qgetenv( qPrintable( "HOME" ) ) ); m_executableFileName = QCoreApplication::applicationName().toLower(); - m_configFileName = m_executableFileName + ".conf"; + m_configFileName = m_executableFileName + ".conf"; m_executableFilePath = m_binaryDirectory.absolutePath() + "/" + m_executableFileName; - m_configFilePath = m_binaryDirectory.absolutePath() + "/" + m_configFileName; + m_configFilePath = m_binaryDirectory.absolutePath() + "/" + m_configFileName; if ( m_tempDirectory.absolutePath().isEmpty() || ( m_tempDirectory.path() == "." ) ) @@ -159,17 +159,17 @@ bool Paths::updatePaths() whereami::whereami_path_t executablePath = whereami::getExecutablePath(); m_executableFileName = QString::fromStdString( executablePath.basename() ); - m_binaryDirectory = QString::fromStdString( executablePath.dirname() ); + m_binaryDirectory = QString::fromStdString( executablePath.dirname() ); m_executableFilePath = QFile( m_binaryDirectory.absolutePath() + "/" + m_executableFileName ); if ( m_binaryDirectory.absolutePath().endsWith( "/bin" ) ) { m_prefixDirectory = m_binaryDirectory.absolutePath().remove( QRegExp( "/bin$" ) ); m_configDirectory = m_prefixDirectory.absolutePath() + "/etc"; - m_cacheDirectory = m_prefixDirectory.absolutePath() + "/var"; - m_dataDirectory = m_prefixDirectory.absolutePath() + "/share"; - m_configFilePath = QFile( m_configDirectory.absolutePath() + "/" + - QCoreApplication::applicationName() + ".conf" ); + m_cacheDirectory = m_prefixDirectory.absolutePath() + "/var"; + m_dataDirectory = m_prefixDirectory.absolutePath() + "/share"; + m_configFilePath = QFile( m_configDirectory.absolutePath() + "/" + + QCoreApplication::applicationName() + ".conf" ); } if ( m_prefixDirectory.absolutePath().startsWith( "/opt" ) || diff --git a/src/myx/filesystem/paths.hpp b/src/myx/filesystem/paths.hpp index 38fd721..96b7ad5 100644 --- a/src/myx/filesystem/paths.hpp +++ b/src/myx/filesystem/paths.hpp @@ -11,15 +11,15 @@ namespace filesystem { class Paths { - QDir m_prefixDirectory; - QDir m_binaryDirectory; - QDir m_configDirectory; - QDir m_cacheDirectory; - QDir m_tempDirectory; - QDir m_dataDirectory; - QDir m_homeDirectory; - QString m_executableFileName; - QString m_configFileName; + QDir m_prefixDirectory; + QDir m_binaryDirectory; + QDir m_configDirectory; + QDir m_cacheDirectory; + QDir m_tempDirectory; + QDir m_dataDirectory; + QDir m_homeDirectory; + QString m_executableFileName; + QString m_configFileName; QFileInfo m_executableFilePath; QFileInfo m_configFilePath; diff --git a/src/myx/filesystem/whereami.cpp b/src/myx/filesystem/whereami.cpp index 3d4565d..867bf63 100644 --- a/src/myx/filesystem/whereami.cpp +++ b/src/myx/filesystem/whereami.cpp @@ -51,7 +51,7 @@ int getExecutablePath( char* out, int capacity, int* dirname_length ) { char buffer[PATH_MAX]; char* resolved = nullptr; - int length = -1; + int length = -1; for (;; ) { @@ -234,16 +234,16 @@ whereami_path_t::operator const whereami_string_t&() const #endif // if defined( WHEREAMI_CXX11 ) #if defined( WHEREAMI_CXX11 ) -whereami_path_t::whereami_path_t( whereami_string_t&& path, int dirname_length ) noexcept - : m_path( std::move( path ) ), +whereami_path_t::whereami_path_t( whereami_string_t&& path, int dirname_length ) noexcept : + m_path ( std::move( path ) ), m_dirnameLength( dirname_length ) { } #else -whereami_path_t::whereami_path_t( whereami_string_t& path, int dirname_length ) - : m_path( path ), +whereami_path_t::whereami_path_t( whereami_string_t& path, int dirname_length ) : + m_path ( path ), m_dirnameLength( dirname_length ) { } diff --git a/src/myx/filesystem/whereami.hpp b/src/myx/filesystem/whereami.hpp index f4d01c0..0fdca45 100644 --- a/src/myx/filesystem/whereami.hpp +++ b/src/myx/filesystem/whereami.hpp @@ -103,7 +103,7 @@ private: #endif whereami_string_t m_path; - int m_dirnameLength; + int m_dirnameLength; }; // class whereami_path_t /** diff --git a/src/myx/log/spdlog.cpp b/src/myx/log/spdlog.cpp index 7fec3b7..71bd6f0 100644 --- a/src/myx/log/spdlog.cpp +++ b/src/myx/log/spdlog.cpp @@ -9,21 +9,21 @@ Logger default_logger( "default" ); Logger::Logger( std::string name ) : - m_logger( nullptr ), - m_name( std::move( name ) ), - m_outputPattern( "[%H:%M:%S %z] [%n] [%^---%L---%$] %v" ), - m_baseFileName( "default" ), - m_maxRotatingFileSize( rotatingFileSize ), + m_logger ( nullptr ), + m_name ( std::move( name ) ), + m_outputPattern ( "[%H:%M:%S %z] [%n] [%^---%L---%$] %v" ), + m_baseFileName ( "default" ), + m_maxRotatingFileSize ( rotatingFileSize ), m_maxRotatingFilesCount( 3 ), - m_outputLevel( spdlog::level::trace ), - m_flushLevel( spdlog::level::warn ), - m_nullSink( nullptr ), - m_stdoutSink( nullptr ), - m_stderrSink( nullptr ), - m_syslogSink( nullptr ), - m_basicFileSink( nullptr ), - m_rotatingFileSink( nullptr ), - m_dailyFileSink( nullptr ) + m_outputLevel ( spdlog::level::trace ), + m_flushLevel ( spdlog::level::warn ), + m_nullSink ( nullptr ), + m_stdoutSink ( nullptr ), + m_stderrSink ( nullptr ), + m_syslogSink ( nullptr ), + m_basicFileSink ( nullptr ), + m_rotatingFileSink ( nullptr ), + m_dailyFileSink ( nullptr ) { m_logger = std::make_shared< spdlog::logger >( m_name, nullptr ); m_logger->sinks().clear(); @@ -235,7 +235,7 @@ void Logger::enableDailyFileSink() { if ( m_dailyFileSink == nullptr ) { - const int rotationHour = 23; + const int rotationHour = 23; const int rotationMinute = 59; m_dailyFileSink = std::make_shared< spdlog::sinks::daily_file_sink_st >( m_baseFileName, rotationHour, rotationMinute ); m_logger->sinks().push_back( m_dailyFileSink ); diff --git a/src/myx/log/spdlog.hpp b/src/myx/log/spdlog.hpp index 6016bb3..5d5d987 100644 --- a/src/myx/log/spdlog.hpp +++ b/src/myx/log/spdlog.hpp @@ -16,21 +16,21 @@ const size_t rotatingFileSize = 256 * 1024; class Logger { - std::shared_ptr< spdlog::logger > m_logger; - std::string m_name; - std::string m_outputPattern; - std::string m_baseFileName; - std::size_t m_maxRotatingFileSize; - std::size_t m_maxRotatingFilesCount; - spdlog::level::level_enum m_outputLevel; - spdlog::level::level_enum m_flushLevel; - std::shared_ptr< spdlog::sinks::null_sink_st > m_nullSink; + std::shared_ptr< spdlog::logger > m_logger; + std::string m_name; + std::string m_outputPattern; + std::string m_baseFileName; + std::size_t m_maxRotatingFileSize; + std::size_t m_maxRotatingFilesCount; + spdlog::level::level_enum m_outputLevel; + spdlog::level::level_enum m_flushLevel; + std::shared_ptr< spdlog::sinks::null_sink_st > m_nullSink; std::shared_ptr< spdlog::sinks::ansicolor_stdout_sink_st > m_stdoutSink; std::shared_ptr< spdlog::sinks::ansicolor_stderr_sink_st > m_stderrSink; - std::shared_ptr< spdlog::sinks::syslog_sink_st > m_syslogSink; - std::shared_ptr< spdlog::sinks::basic_file_sink_st > m_basicFileSink; - std::shared_ptr< spdlog::sinks::rotating_file_sink_st > m_rotatingFileSink; - std::shared_ptr< spdlog::sinks::daily_file_sink_st > m_dailyFileSink; + std::shared_ptr< spdlog::sinks::syslog_sink_st > m_syslogSink; + std::shared_ptr< spdlog::sinks::basic_file_sink_st > m_basicFileSink; + std::shared_ptr< spdlog::sinks::rotating_file_sink_st > m_rotatingFileSink; + std::shared_ptr< spdlog::sinks::daily_file_sink_st > m_dailyFileSink; public: Logger( std::string name ); diff --git a/src/myx/log/spdlog_qt.cpp b/src/myx/log/spdlog_qt.cpp index 04795d2..a61b1be 100644 --- a/src/myx/log/spdlog_qt.cpp +++ b/src/myx/log/spdlog_qt.cpp @@ -37,7 +37,7 @@ void spdlog_qt_message_handler( QtMsgType type, const QMessageLogContext& contex QCoreApplication::exit( 1 ); break; } -} // messageHandler +} // messageHandler } // namespace log