log_msg to contain logger_name + astyle
This commit is contained in:
		@@ -21,7 +21,9 @@ public:
 | 
			
		||||
    stack_devicebuf(const stack_devicebuf& other) :std::basic_streambuf<char>(), _stackbuf(other._stackbuf)
 | 
			
		||||
    {}
 | 
			
		||||
 | 
			
		||||
    stack_devicebuf(stack_devicebuf&& other) :std::basic_streambuf<char>(), _stackbuf(std::move(other._stackbuf))
 | 
			
		||||
    stack_devicebuf(stack_devicebuf&& other):
 | 
			
		||||
        std::basic_streambuf<char>(),
 | 
			
		||||
        _stackbuf(std::move(other._stackbuf))
 | 
			
		||||
    {
 | 
			
		||||
        other.clear();
 | 
			
		||||
    }
 | 
			
		||||
@@ -102,4 +104,4 @@ private:
 | 
			
		||||
    stack_devicebuf _dev;
 | 
			
		||||
};
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -12,8 +12,8 @@ public:
 | 
			
		||||
    explicit file_flush_helper(const std::size_t flush_every):
 | 
			
		||||
        _flush_every(flush_every),
 | 
			
		||||
        _flush_countdown(flush_every) {};
 | 
			
		||||
  	
 | 
			
		||||
	void write(const std::string& msg, std::ofstream& ofs)
 | 
			
		||||
 | 
			
		||||
    void write(const std::string& msg, std::ofstream& ofs)
 | 
			
		||||
    {
 | 
			
		||||
        ofs.write(msg.data(), msg.size());
 | 
			
		||||
        if(--_flush_countdown == 0)
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,8 @@ public:
 | 
			
		||||
    {
 | 
			
		||||
        if (_enabled)
 | 
			
		||||
        {
 | 
			
		||||
			_log_msg.time = log_clock::now();
 | 
			
		||||
            _log_msg.logger_name = _callback_logger->get_name();
 | 
			
		||||
            _log_msg.time = log_clock::now();
 | 
			
		||||
            _log_msg.raw = _oss.str();
 | 
			
		||||
            _callback_logger->_log_it(_log_msg);
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -8,6 +8,7 @@ struct log_msg
 | 
			
		||||
{
 | 
			
		||||
    log_msg() = default;
 | 
			
		||||
    log_msg(level::level_enum l):
 | 
			
		||||
        logger_name(),
 | 
			
		||||
        level(l),
 | 
			
		||||
        time(),
 | 
			
		||||
        raw(),
 | 
			
		||||
@@ -15,6 +16,7 @@ struct log_msg
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    log_msg(const log_msg& other):
 | 
			
		||||
        logger_name(other.logger_name),
 | 
			
		||||
        level(other.level),
 | 
			
		||||
        time(other.time),
 | 
			
		||||
        raw(other.raw),
 | 
			
		||||
@@ -28,6 +30,7 @@ struct log_msg
 | 
			
		||||
    friend void swap(log_msg& l, log_msg& r)
 | 
			
		||||
    {
 | 
			
		||||
        using std::swap;
 | 
			
		||||
        swap(l.logger_name, r.logger_name);
 | 
			
		||||
        swap(l.level, r.level);
 | 
			
		||||
        swap(l.time, r.time);
 | 
			
		||||
        swap(l.raw, r.raw);
 | 
			
		||||
@@ -48,6 +51,7 @@ struct log_msg
 | 
			
		||||
        formatted.clear();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    std::string logger_name;
 | 
			
		||||
    level::level_enum level;
 | 
			
		||||
    log_clock::time_point time;
 | 
			
		||||
    std::string raw;
 | 
			
		||||
 
 | 
			
		||||
@@ -5,9 +5,7 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <cstring>
 | 
			
		||||
 | 
			
		||||
// Fast memory storage
 | 
			
		||||
// stores its contents on the stack when possible, in vector<char> otherwise
 | 
			
		||||
// NOTE: User should be remember that returned buffer might be on the stack!!
 | 
			
		||||
// Fast memory storage on the stack when possible or in std::vector
 | 
			
		||||
namespace c11log
 | 
			
		||||
{
 | 
			
		||||
namespace details
 | 
			
		||||
@@ -24,11 +22,6 @@ public:
 | 
			
		||||
 | 
			
		||||
    stack_buf& operator=(const stack_buf& other) = delete;
 | 
			
		||||
 | 
			
		||||
    stack_buf(const bufpair_t& buf_to_copy) :stack_buf()
 | 
			
		||||
    {
 | 
			
		||||
        append(buf_to_copy);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    stack_buf(const stack_buf& other)
 | 
			
		||||
    {
 | 
			
		||||
        _stack_size = other._stack_size;
 | 
			
		||||
@@ -108,4 +101,4 @@ private:
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
} //namespace c11log { namespace details {
 | 
			
		||||
} //namespace c11log { namespace details {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user