File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ class Sink {
51
51
std::string logger_name;
52
52
bool skip_prefix;
53
53
std::mutex output_mutex;
54
+ const char *error_prefix = " Log message syntax error: " ;
54
55
55
56
void format (std::ostringstream &buffer, const char *fmt) {
56
57
while (*fmt != ' \0 ' ) {
@@ -62,15 +63,16 @@ class Sink {
62
63
if (*(++fmt) == ' {' ) {
63
64
buffer << *fmt++;
64
65
} else {
65
- throw std::runtime_error (
66
- " No arguments provided and braces not escaped!" );
66
+ std::cerr
67
+ << error_prefix
68
+ << " No arguments provided and braces not escaped!" ;
67
69
}
68
70
} else if (*fmt == ' }' ) {
69
71
if (*(++fmt) == ' }' ) {
70
72
buffer << *fmt++;
71
73
} else {
72
- throw std::runtime_error (
73
- " Closing curly brace not escaped!" ) ;
74
+ std::cerr << error_prefix
75
+ << " Closing curly brace not escaped!" ;
74
76
}
75
77
}
76
78
}
@@ -90,7 +92,8 @@ class Sink {
90
92
if (*(++fmt) == ' {' ) {
91
93
buffer << *fmt++;
92
94
} else if (*fmt != ' }' ) {
93
- throw std::runtime_error (" Only empty braces are allowed!" );
95
+ std::cerr << error_prefix
96
+ << " Only empty braces are allowed!" ;
94
97
} else {
95
98
buffer << arg;
96
99
arg_printed = true ;
@@ -99,8 +102,8 @@ class Sink {
99
102
if (*(++fmt) == ' }' ) {
100
103
buffer << *fmt++;
101
104
} else {
102
- throw std::runtime_error (
103
- " Closing curly brace not escaped!" ) ;
105
+ std::cerr << error_prefix
106
+ << " Closing curly brace not escaped!" ;
104
107
}
105
108
}
106
109
}
You can’t perform that action at this time.
0 commit comments