mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 10:01:33 +08:00
gcc warnings fix
This commit is contained in:
parent
5f4d4d0909
commit
e6345e008b
@ -37,9 +37,9 @@ int main(int argc, char* argv[])
|
|||||||
auto delta = system_clock::now() - start;
|
auto delta = system_clock::now() - start;
|
||||||
auto delta_d = duration_cast<duration<double>> (delta).count();
|
auto delta_d = duration_cast<duration<double>> (delta).count();
|
||||||
|
|
||||||
cout << "Total:" << format(howmany) << endl;
|
cout_logger.info("Total:") << format(howmany);
|
||||||
cout << "Delta:" << format(delta_d) << endl;
|
cout_logger.info("Delta:") << format(delta_d);
|
||||||
cout << "Rate:" << format(howmany / delta_d) << "/sec" << endl;
|
cout_logger.info("Rate:") << format(howmany / delta_d) << "/sec";
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#include "c11log/sinks/file_sinks.h"
|
#include "c11log/sinks/file_sinks.h"
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
int main2(int, char* [])
|
int main(int, char* [])
|
||||||
{
|
{
|
||||||
|
|
||||||
auto console = c11log::factory::stdout_logger();
|
auto console = c11log::factory::stdout_logger();
|
||||||
|
@ -89,9 +89,9 @@ public:
|
|||||||
|
|
||||||
std::string str()
|
std::string str()
|
||||||
{
|
{
|
||||||
auto buf = _dev.buf();
|
auto buffer = _dev.buf();
|
||||||
const char*data = buf.data();
|
const char*data = buffer.data();
|
||||||
return std::string(data, data+buf.size());
|
return std::string(data, data+buffer.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
const stack_devicebuf::stackbuf_t& buf() const
|
const stack_devicebuf::stackbuf_t& buf() const
|
||||||
@ -133,8 +133,8 @@ public:
|
|||||||
|
|
||||||
void write_fast_oss(const fast_oss& oss)
|
void write_fast_oss(const fast_oss& oss)
|
||||||
{
|
{
|
||||||
auto buf = oss.buf();
|
auto buffer = oss.buf();
|
||||||
_dev.sputn(buf.data(), buf.size());
|
_dev.sputn(buffer.data(), buffer.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
|
|
||||||
// Fast memory storage on the stack when possible or in std::vector
|
// Fast memory storage on the stack when possible or in std::vector
|
||||||
|
@ -29,7 +29,7 @@ class logger
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using sink_ptr = std::shared_ptr<sinks::sink>;
|
using sink_ptr = std::shared_ptr<sinks::sink>;
|
||||||
using formatter_ptr = std::shared_ptr<formatter>;
|
using formatter_ptr = std::shared_ptr<c11log::formatter>;
|
||||||
|
|
||||||
logger(const std::string& name, std::initializer_list<sink_ptr>, formatter_ptr formatter = nullptr);
|
logger(const std::string& name, std::initializer_list<sink_ptr>, formatter_ptr formatter = nullptr);
|
||||||
template<class It>
|
template<class It>
|
||||||
@ -93,12 +93,12 @@ private:
|
|||||||
#include "details/line_logger.h"
|
#include "details/line_logger.h"
|
||||||
|
|
||||||
|
|
||||||
inline c11log::logger::logger(const std::string& logger_name, std::initializer_list<sink_ptr> sinks_list, formatter_ptr formatter) :
|
inline c11log::logger::logger(const std::string& logger_name, std::initializer_list<sink_ptr> sinks_list, formatter_ptr msg_formatter) :
|
||||||
_name(logger_name),
|
_name(logger_name),
|
||||||
_formatter(formatter),
|
_formatter(msg_formatter),
|
||||||
_sinks(sinks_list)
|
_sinks(sinks_list)
|
||||||
{
|
{
|
||||||
if (!formatter) //default formatter
|
if (!msg_formatter) //default formatter
|
||||||
_formatter = std::make_shared<details::pattern_formatter>(_default_pattern);
|
_formatter = std::make_shared<details::pattern_formatter>(_default_pattern);
|
||||||
|
|
||||||
// no support under vs2013 for member initialization for std::atomic
|
// no support under vs2013 for member initialization for std::atomic
|
||||||
@ -169,10 +169,9 @@ inline bool c11log::logger::should_log(c11log::level::level_enum msg_level) cons
|
|||||||
return msg_level >= _level.load();
|
return msg_level >= _level.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void c11log::logger::formatter(formatter_ptr msg_formatter)
|
||||||
inline void c11log::logger::formatter(formatter_ptr formatter)
|
|
||||||
{
|
{
|
||||||
_formatter = formatter;
|
_formatter = msg_formatter;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline c11log::logger::formatter_ptr c11log::logger::formatter() const
|
inline c11log::logger::formatter_ptr c11log::logger::formatter() const
|
||||||
|
Loading…
Reference in New Issue
Block a user