<commit_before>#pragma once

#include <torrentsync/utils/log/Log.h>
#include <torrentsync/utils/log/LogStream.h>

#include <list>

//#include <boost/utility.hpp>

#define LOG(LEVEL, MSG) {\
auto& _logger = torrentsync::utils::log::Logger::getInstance();\
auto _level = torrentsync::utils::log::LEVEL;\
if( _logger.willLog(_level) ) { _logger.log(_level) << MSG <<\
    torrentsync::utils::log::logend;}}

namespace torrentsync
{
namespace utils
{
namespace log
{

/**
 * Default log level: WARN
 **/
class Logger : boost::noncopyable
{
public:

    static Logger& getInstance() noexcept;

    LogStream log( const Level level );

    //! Sets the policy to force the log to be flushed at each operations
    //! @param forceFlush boolean value for the flag
    static void setForceFlush( const bool forceFlush );

    //! Returns the value of the global flag to force log files to be flushed
    //! @return the flag value
    static bool getForceFlush() noexcept;

    static Level getLogLevel() noexcept;

    void addSink( std::unique_ptr<std::ostream>&& , const Level );

    bool willLog( const Level ) const noexcept;

    void destroy();

private:
    //! Logger constructor
    Logger();

    static Level _level;

    //! this flag determines if the logs must be flushed after any message is !
    //! sent. Very useful in case of crashes that happends when the log is still
    //! buffered.. Enable only when necessary, by default it's false.
    static bool _forceFlush;

    //! Registered sinks to store the logs to
    std::list<Sink> _sinks;

};

} // log
} // utils
} // torrentsync<commit_msg>Added Documentation<commit_after>#pragma once

#include <torrentsync/utils/log/Log.h>
#include <torrentsync/utils/log/LogStream.h>

#include <list>

//#include <boost/utility.hpp>

#define LOG(LEVEL, MSG) {\
auto& _logger = torrentsync::utils::log::Logger::getInstance();\
auto _level = torrentsync::utils::log::LEVEL;\
if( _logger.willLog(_level) ) { _logger.log(_level) << MSG <<\
    torrentsync::utils::log::logend;}}

namespace torrentsync
{
namespace utils
{
namespace log
{

/**
 * Default log level: WARN
 **/
class Logger : boost::noncopyable
{
public:

    static Logger& getInstance() noexcept;

    LogStream log( const Level level );

    //! Sets the policy to force the log to be flushed at each operations
    //! @param forceFlush boolean value for the flag
    static void setForceFlush( const bool forceFlush );

    //! Returns the value of the global flag to force log files to be flushed
    //! @return the flag value
    static bool getForceFlush() noexcept;

    static Level getLogLevel() noexcept;

    // Adding sinks in not thread safe. No other logging action should happend
    // at the same time.
    void addSink( std::unique_ptr<std::ostream>&& , const Level );

    // tests if the log level will be logged
    bool willLog( const Level ) const noexcept;

    // It's not thread safe, should be called only when all logging has
    // completed.
    void destroy();

private:
    //! Logger constructor
    Logger();

    static Level _level;

    //! this flag determines if the logs must be flushed after any message is !
    //! sent. Very useful in case of crashes that happends when the log is still
    //! buffered.. Enable only when necessary, by default it's false.
    static bool _forceFlush;

    //! Registered sinks to store the logs to
    std::list<Sink> _sinks;

};

} // log
} // utils
} // torrentsync
{'fraction_non_alphanumeric': 0.11277761753677532, 'fraction_numerical': 0.0, 'mean_word_length': 3.3080745341614906, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6695030', 'n_tokens_mistral': 1040, 'n_tokens_neox': 998, 'n_words': 377}