|
|
@@ -144,7 +144,7 @@ consumer::format_type consumer::parse_format(const std::string& format) |
|
|
|
if (s < c) |
|
|
|
{ |
|
|
|
if (!ret.empty() && !ret.back().empty() && *ret.back().c_str() != '\0') |
|
|
|
ret.back() += std::string(s, static_cast<size_t>(c - s - 1)); |
|
|
|
ret.back() += std::string(s, cpplogging_convert_cast<size_t>(c - s - 1)); |
|
|
|
else |
|
|
|
ret.emplace_back(s, c - s); |
|
|
|
} |
|
|
@@ -174,7 +174,7 @@ consumer::format_type consumer::parse_format(const std::string& format) |
|
|
|
if (s + 1 < c) |
|
|
|
{ |
|
|
|
if (!ret.empty() && !ret.back().empty() && *ret.back().c_str() != '\0') |
|
|
|
ret.back() += std::string(s, static_cast<size_t>(c - s - 1)); |
|
|
|
ret.back() += std::string(s, cpplogging_convert_cast<size_t>(c - s - 1)); |
|
|
|
else |
|
|
|
ret.emplace_back(s, c - s - 1); |
|
|
|
} |
|
|
@@ -197,7 +197,7 @@ consumer::format_type consumer::parse_format(const std::string& format) |
|
|
|
/* if we are in 'is_in_token' we extract the token and switch to 'is_in_format' */ |
|
|
|
case parser_state::is_in_token: |
|
|
|
state = parser_state::is_in_format; |
|
|
|
item.token = value_token_map.get_token(std::string(x, static_cast<size_t>(c - x))); |
|
|
|
item.token = value_token_map.get_token(std::string(x, cpplogging_convert_cast<size_t>(c - x))); |
|
|
|
if (item.token == value_token::unknown) |
|
|
|
{ |
|
|
|
state = parser_state::is_text; |
|
|
@@ -270,7 +270,7 @@ consumer::format_type consumer::parse_format(const std::string& format) |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
item.width = static_cast<uint8_t>(u); |
|
|
|
item.width = cpplogging_convert_cast<uint8_t>(u); |
|
|
|
x = c + 1; |
|
|
|
state = parser_state::is_in_format_dot; |
|
|
|
} |
|
|
@@ -326,9 +326,9 @@ consumer::format_type consumer::parse_format(const std::string& format) |
|
|
|
else |
|
|
|
{ |
|
|
|
if (state == parser_state::is_in_format_dot) |
|
|
|
item.precision = static_cast<uint8_t>(u); |
|
|
|
item.precision = cpplogging_convert_cast<uint8_t>(u); |
|
|
|
else |
|
|
|
item.width = static_cast<uint8_t>(u); |
|
|
|
item.width = cpplogging_convert_cast<uint8_t>(u); |
|
|
|
|
|
|
|
/* set the type and switch to 'is_in_format_type' */ |
|
|
|
x = c + 1; |
|
|
@@ -360,7 +360,7 @@ consumer::format_type consumer::parse_format(const std::string& format) |
|
|
|
/* if we are in 'is_in_token' we extract the token, add the item and switch to 'is_text' */ |
|
|
|
case parser_state::is_in_token: |
|
|
|
state = parser_state::is_text; |
|
|
|
item.token = value_token_map.get_token(std::string(x, static_cast<size_t>(c - x))); |
|
|
|
item.token = value_token_map.get_token(std::string(x, cpplogging_convert_cast<size_t>(c - x))); |
|
|
|
if (item.token == value_token::unknown) |
|
|
|
{ |
|
|
|
state = parser_state::is_text; |
|
|
@@ -390,9 +390,9 @@ consumer::format_type consumer::parse_format(const std::string& format) |
|
|
|
if (x != tmp && x <= c) |
|
|
|
{ |
|
|
|
if (state == parser_state::is_in_format_dot) |
|
|
|
item.precision = static_cast<uint8_t>(u); |
|
|
|
item.precision = cpplogging_convert_cast<uint8_t>(u); |
|
|
|
else |
|
|
|
item.width = static_cast<uint8_t>(u); |
|
|
|
item.width = cpplogging_convert_cast<uint8_t>(u); |
|
|
|
ret.emplace_back(item.as_string()); |
|
|
|
} |
|
|
|
item.reset(); |
|
|
@@ -482,7 +482,7 @@ void consumer::write_formatted(const log_entry& e, const format_type& f, std::os |
|
|
|
switch (i.format) |
|
|
|
{ |
|
|
|
case value_format::decimal: |
|
|
|
os << static_cast<int>(e.level); |
|
|
|
os << cpplogging_convert_cast<int>(e.level); |
|
|
|
break; |
|
|
|
case value_format::string_upper: |
|
|
|
switch (e.level) |
|
|
|