Index: ext/libicpf/src/libicpf/log.cpp =================================================================== diff -u -re31dc31ccf2010abee81ddc399d65b57e4803278 -r9c8dee07d9aecabc260a856da2b2dc350b7098a2 --- ext/libicpf/src/libicpf/log.cpp (.../log.cpp) (revision e31dc31ccf2010abee81ddc399d65b57e4803278) +++ ext/libicpf/src/libicpf/log.cpp (.../log.cpp) (revision 9c8dee07d9aecabc260a856da2b2dc350b7098a2) @@ -20,6 +20,7 @@ * \brief Contains the implamentation of a log class. */ #include "log.h" +#include #include "exception.h" #include #include @@ -95,6 +96,44 @@ fclose(pFile); } +// ============================================================================ +/// icpf::log_file::is_initialized +/// @date 2009/05/19 +/// +/// @brief Checks is the log_file object has been initialized. +/// @return True if it has been initialized, false otherwise. +// ============================================================================ +bool log_file::is_initialized() const throw() +{ + return m_pszPath != 0; +} + +// ============================================================================ +/// icpf::log_file::set_log_level +/// @date 2009/05/23 +/// +/// @brief Changes the log level for this class. +/// @param[in] iLogLevel New log level. +// ============================================================================ +void log_file::set_log_level(int_t iLogLevel) throw() +{ + m_iLogLevel = iLogLevel; +} + +// ============================================================================ +/// icpf::log_file::set_max_size +/// @date 2009/05/23 +/// +/// @brief Sets the max size of the log file. +/// @param[in] iMaxSize Max size of the log file. +// ============================================================================ +void log_file::set_max_size(int_t iMaxSize) throw() +{ + BOOST_ASSERT(iMaxSize > 0); + if(iMaxSize > 0) + m_iMaxSize = iMaxSize; +} + /** Retrieves the current size of a log file. * Quite slow function - have to access the file by opening and closing it. * \return Current file size. @@ -118,7 +157,6 @@ return iSize; } -// @lAdd - count of bytes that would be appended to the file /** Truncates the current log file content so when adding some new text the * file size won't exceed the maximum size specified in init(). * \param[in] iAdd - size of the new string to be added to the log file Index: ext/libicpf/src/libicpf/log.h =================================================================== diff -u -re31dc31ccf2010abee81ddc399d65b57e4803278 -r9c8dee07d9aecabc260a856da2b2dc350b7098a2 --- ext/libicpf/src/libicpf/log.h (.../log.h) (revision e31dc31ccf2010abee81ddc399d65b57e4803278) +++ ext/libicpf/src/libicpf/log.h (.../log.h) (revision 9c8dee07d9aecabc260a856da2b2dc350b7098a2) @@ -34,7 +34,7 @@ * Class used to perform message logging to the external file. Provides a possibility * of limiting the max size of a file and to cut the log message types below a specific * level. - * Class is thread safe. + * Class is thread safe (is it? most of the methods does not seem to be thread safe). */ class LIBICPF_API log_file { @@ -58,6 +58,11 @@ /** \name Initialization */ /**@{*/ void init(const tchar_t* pszPath, int_t iMaxSize, int_t iLogLevel, bool bLogStd, bool bClean); ///< Initializes the logging object + bool is_initialized() const throw(); + + void set_log_level(int_t iLogLevel) throw(); ///< Sets the log level + void set_max_size(int_t iMaxSize) throw(); ///< Sets the max size + /**@}*/ /** \name Logging functions */