Simplified sink interface - to just accept char* and size_t

This commit is contained in:
gabi
2014-11-21 00:13:24 +02:00
parent a9abfbb005
commit 66039c7c0e
8 changed files with 60 additions and 54 deletions

View File

@@ -82,10 +82,10 @@ public:
void reopen()
{
if(_filename.empty())
throw spdlog_ex("Failed re opening file - was not opened before");
open(_filename);
if(_filename.empty())
throw spdlog_ex("Failed re opening file - was not opened before");
open(_filename);
}
void close()
@@ -97,11 +97,11 @@ public:
}
}
void write(const log_msg& msg)
void write(const char* data, size_t size)
{
auto& buf = msg.formatted.buf();
size_t size = buf.size();
if(std::fwrite(buf.data(), sizeof(char), size, _fd) != size)
if(std::fwrite(data, sizeof(char), size, _fd) != size)
throw spdlog_ex("Failed writing to file " + _filename);
if(--_flush_countdown == 0)