mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-30 01:04:05 +08:00
Fixed warnings
This commit is contained in:
parent
28ea21b241
commit
9f4492da61
@ -121,6 +121,7 @@ struct fmt::formatter<spdlog::details::dump_info<T>, char> {
|
||||
show_ascii = true;
|
||||
}
|
||||
break;
|
||||
default:;
|
||||
}
|
||||
|
||||
++it;
|
||||
|
@ -28,11 +28,11 @@ struct hourly_filename_calculator {
|
||||
static filename_t calc_filename(const filename_t &filename, const tm &now_tm) {
|
||||
filename_t basename, ext;
|
||||
std::tie(basename, ext) = details::os::split_by_extension(filename);
|
||||
std::basic_ostringstream<filename_t::value_type> oss;
|
||||
std::basic_ostringstream<filename_t::value_type> oss;
|
||||
oss << basename.native() << '_' << std::setfill(SPDLOG_FILENAME_T('0')) << std::setw(4) << now_tm.tm_year + 1900 << '-'
|
||||
<< std::setw(2) << now_tm.tm_mon + 1 << '-' << std::setw(2) << now_tm.tm_mday << '_' << std::setw(2) << now_tm.tm_hour
|
||||
<< ext.native();
|
||||
return oss.str();
|
||||
return oss.str();
|
||||
}
|
||||
};
|
||||
|
||||
@ -47,7 +47,7 @@ template <typename Mutex, typename FileNameCalc = hourly_filename_calculator>
|
||||
class hourly_file_sink final : public base_sink<Mutex> {
|
||||
public:
|
||||
// create hourly file sink which rotates on given time
|
||||
hourly_file_sink(filename_t base_filename,
|
||||
explicit hourly_file_sink(filename_t base_filename,
|
||||
bool truncate = false,
|
||||
uint16_t max_files = 0,
|
||||
const file_event_handlers &event_handlers = {})
|
||||
|
@ -21,7 +21,7 @@ template <typename Mutex>
|
||||
class msvc_sink final : public base_sink<Mutex> {
|
||||
public:
|
||||
msvc_sink() = default;
|
||||
msvc_sink(bool check_debugger_present)
|
||||
explicit msvc_sink(bool check_debugger_present)
|
||||
: check_debugger_present_{check_debugger_present} {}
|
||||
|
||||
protected:
|
||||
|
@ -29,9 +29,11 @@ void file_helper::open(const filename_t &fname, bool truncate) {
|
||||
if (event_handlers_.before_open) {
|
||||
event_handlers_.before_open(filename_);
|
||||
}
|
||||
|
||||
// create containing folder if not exists already.
|
||||
os::create_dir(os::dir_name(fname));
|
||||
|
||||
for (int tries = 0; tries < open_tries_; ++tries) {
|
||||
// create containing folder if not exists already.
|
||||
os::create_dir(os::dir_name(fname));
|
||||
if (truncate) {
|
||||
// Truncate by opening-and-closing a tmp file in "wb" mode, always
|
||||
// opening the actual log-we-write-to in "ab" mode, since that
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
using spdlog::details::file_helper;
|
||||
|
||||
static void write_with_helper(file_helper &helper, size_t howmany) {
|
||||
static void write_with_helper(const file_helper &helper, size_t howmany) {
|
||||
spdlog::memory_buf_t formatted;
|
||||
spdlog::fmt_lib::format_to(std::back_inserter(formatted), "{}", std::string(howmany, '1'));
|
||||
helper.write(formatted);
|
||||
|
Loading…
Reference in New Issue
Block a user