mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-29 01:29:35 +08:00
Added pattern formatter and updated related stuff
This commit is contained in:
@@ -5,8 +5,10 @@
|
||||
|
||||
#include <ostream>
|
||||
#include <iomanip>
|
||||
#include "fast_istostr.h"
|
||||
#include "stack_buf.h"
|
||||
|
||||
|
||||
namespace c11log
|
||||
{
|
||||
namespace details
|
||||
@@ -15,7 +17,7 @@ namespace details
|
||||
class stack_devicebuf :public std::streambuf
|
||||
{
|
||||
public:
|
||||
static const unsigned short stack_size = 192;
|
||||
static const unsigned short stack_size = 256;
|
||||
using stackbuf_t = stack_buf<stack_size>;
|
||||
|
||||
stack_devicebuf() = default;
|
||||
@@ -103,6 +105,29 @@ public:
|
||||
_dev.clear();
|
||||
}
|
||||
|
||||
// The following were added because they add significant boost to perfromance
|
||||
void putc(char c)
|
||||
{
|
||||
_dev.sputc(c);
|
||||
}
|
||||
|
||||
|
||||
// put int and pad with zeroes if smalled than min_width
|
||||
void put_int(int n, int min_width)
|
||||
{
|
||||
std::string s;
|
||||
details::fast_itostr(n, s, min_width);
|
||||
_dev.sputn(s.data(), s.size());
|
||||
//sprintf_s(buf, "%d", n);
|
||||
//_dev.sputn(buf, width);
|
||||
}
|
||||
|
||||
void put_str(const std::string& str)
|
||||
{
|
||||
_dev.sputn(str.data(), str.size());
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
stack_devicebuf _dev;
|
||||
};
|
||||
|
Reference in New Issue
Block a user