mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-16 00:45:48 +08:00
Use emplace_back in pattern_formatter
This commit is contained in:
parent
bdca50e6a7
commit
6df52df5b4
@ -503,7 +503,6 @@ inline void spdlog::pattern_formatter::compile_pattern(const std::string& patter
|
||||
{
|
||||
if (user_chars) //append user chars found so far
|
||||
_formatters.push_back(std::move(user_chars));
|
||||
|
||||
if (++it != end)
|
||||
handle_flag(*it);
|
||||
else
|
||||
@ -528,135 +527,135 @@ inline void spdlog::pattern_formatter::handle_flag(char flag)
|
||||
{
|
||||
// logger name
|
||||
case 'n':
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::name_formatter()));
|
||||
_formatters.emplace_back(new details::name_formatter());
|
||||
break;
|
||||
|
||||
case 'l':
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::level_formatter()));
|
||||
_formatters.emplace_back(new details::level_formatter());
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::short_level_formatter()));
|
||||
_formatters.emplace_back(new details::short_level_formatter());
|
||||
break;
|
||||
|
||||
case('t'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::t_formatter()));
|
||||
_formatters.emplace_back(new details::t_formatter());
|
||||
break;
|
||||
|
||||
case('v'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::v_formatter()));
|
||||
_formatters.emplace_back(new details::v_formatter());
|
||||
break;
|
||||
|
||||
case('a'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::a_formatter()));
|
||||
_formatters.emplace_back(new details::a_formatter());
|
||||
break;
|
||||
|
||||
case('A'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::A_formatter()));
|
||||
_formatters.emplace_back(new details::A_formatter());
|
||||
break;
|
||||
|
||||
case('b'):
|
||||
case('h'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::b_formatter()));
|
||||
_formatters.emplace_back(new details::b_formatter());
|
||||
break;
|
||||
|
||||
case('B'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::B_formatter()));
|
||||
_formatters.emplace_back(new details::B_formatter());
|
||||
break;
|
||||
case('c'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::c_formatter()));
|
||||
_formatters.emplace_back(new details::c_formatter());
|
||||
break;
|
||||
|
||||
case('C'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::C_formatter()));
|
||||
_formatters.emplace_back(new details::C_formatter());
|
||||
break;
|
||||
|
||||
case('Y'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::Y_formatter()));
|
||||
_formatters.emplace_back(new details::Y_formatter());
|
||||
break;
|
||||
|
||||
case('D'):
|
||||
case('x'):
|
||||
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::D_formatter()));
|
||||
_formatters.emplace_back(new details::D_formatter());
|
||||
break;
|
||||
|
||||
case('m'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::m_formatter()));
|
||||
_formatters.emplace_back(new details::m_formatter());
|
||||
break;
|
||||
|
||||
case('d'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::d_formatter()));
|
||||
_formatters.emplace_back(new details::d_formatter());
|
||||
break;
|
||||
|
||||
case('H'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::H_formatter()));
|
||||
_formatters.emplace_back(new details::H_formatter());
|
||||
break;
|
||||
|
||||
case('I'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::I_formatter()));
|
||||
_formatters.emplace_back(new details::I_formatter());
|
||||
break;
|
||||
|
||||
case('M'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::M_formatter()));
|
||||
_formatters.emplace_back(new details::M_formatter());
|
||||
break;
|
||||
|
||||
case('S'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::S_formatter()));
|
||||
_formatters.emplace_back(new details::S_formatter());
|
||||
break;
|
||||
|
||||
case('e'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::e_formatter()));
|
||||
_formatters.emplace_back(new details::e_formatter());
|
||||
break;
|
||||
|
||||
case('f'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::f_formatter()));
|
||||
_formatters.emplace_back(new details::f_formatter());
|
||||
break;
|
||||
case('F'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::F_formatter()));
|
||||
_formatters.emplace_back(new details::F_formatter());
|
||||
break;
|
||||
|
||||
case('E'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::E_formatter()));
|
||||
_formatters.emplace_back(new details::E_formatter());
|
||||
break;
|
||||
|
||||
case('p'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::p_formatter()));
|
||||
_formatters.emplace_back(new details::p_formatter());
|
||||
break;
|
||||
|
||||
case('r'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::r_formatter()));
|
||||
_formatters.emplace_back(new details::r_formatter());
|
||||
break;
|
||||
|
||||
case('R'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::R_formatter()));
|
||||
_formatters.emplace_back(new details::R_formatter());
|
||||
break;
|
||||
|
||||
case('T'):
|
||||
case('X'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::T_formatter()));
|
||||
_formatters.emplace_back(new details::T_formatter());
|
||||
break;
|
||||
|
||||
case('z'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::z_formatter()));
|
||||
_formatters.emplace_back(new details::z_formatter());
|
||||
break;
|
||||
|
||||
case ('+'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::full_formatter()));
|
||||
_formatters.emplace_back(new details::full_formatter());
|
||||
break;
|
||||
|
||||
case ('P'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::pid_formatter()));
|
||||
_formatters.emplace_back(new details::pid_formatter());
|
||||
break;
|
||||
|
||||
|
||||
case ('i'):
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::i_formatter()));
|
||||
_formatters.emplace_back(new details::i_formatter());
|
||||
break;
|
||||
|
||||
default: //Unknown flag appears as is
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::ch_formatter('%')));
|
||||
_formatters.push_back(std::unique_ptr<details::flag_formatter>(new details::ch_formatter(flag)));
|
||||
_formatters.emplace_back(new details::ch_formatter('%'));
|
||||
_formatters.emplace_back(new details::ch_formatter(flag));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user