Skip whitespace more liberally when parsing PLTSTDERR and friends.
Now accepts any whitespace, not just spaces, ignores both leading and trailing whitespace, and accepts multiple whitespace characters separating subterms.
This commit is contained in:
parent
99dd403ef6
commit
1ba42bb70d
|
@ -41,16 +41,17 @@ through environment variables:
|
|||
@litchar{none}, @litchar{fatal}, @litchar{error},
|
||||
@litchar{warning}, @litchar{info}, or @litchar{debug}; all
|
||||
events the corresponding level of higher are printed. After an
|
||||
initial @nonterm{level}, the value can contain space-separated
|
||||
specifications of the form
|
||||
@nonterm{level}@litchar["@"]@nonterm{topic}, which prints events
|
||||
whose topics match @nonterm{topic} only at the given
|
||||
initial @nonterm{level}, the value can contain
|
||||
whitespace-separated specifications of the form
|
||||
@nonterm{level}@litchar["@"]@nonterm{topic}, which prints
|
||||
events whose topics match @nonterm{topic} only at the given
|
||||
@nonterm{level} or higher (where a @nonterm{topic} contains any
|
||||
character other than a space or @litchar["@"]). For example,
|
||||
the value @racket["error debug@GC"] prints all events at the
|
||||
@racket['error] level and higher, but prints events for the topic
|
||||
topic @racket['GC] at the @racket['debug] level and
|
||||
higher (which includes all levels).
|
||||
character other than whitespace or @litchar["@"]). Leading and
|
||||
trailing whitespace is ignored. For example, the value
|
||||
@racket["error debug@GC"] prints all events at the
|
||||
@racket['error] level and higher, but prints events for the
|
||||
topic @racket['GC] at the @racket['debug] level and higher
|
||||
(which includes all levels).
|
||||
|
||||
The default is @racket["error"].}
|
||||
|
||||
|
@ -73,6 +74,12 @@ logger to report events. For example, the bytecode compiler sometimes
|
|||
reports @racket['warning] events when it detects an expression that
|
||||
would produce a run-time error if evaluated.
|
||||
|
||||
@history[#:changed "6.6.0.2" @elem{Prior to version 6.6.0.2, parsing
|
||||
of @envvar{PLTSTDERR} and @envvar{PLTSYSLOG} was very strict.
|
||||
Leading and trailing whitespace was forbidden, and anything other
|
||||
than exactly one space character separating two specifications was
|
||||
rejected.}]
|
||||
|
||||
@; ----------------------------------------
|
||||
@section{Creating Loggers}
|
||||
|
||||
|
|
|
@ -746,6 +746,8 @@ static Scheme_Object *reverse_path_list(Scheme_Object *l, int rel_to_cwd)
|
|||
# define GC_CAN_IGNORE /**/
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
static Scheme_Object *get_log_level(char *prog, char *real_switch, const char *envvar, const char *what, GC_CAN_IGNORE char *str)
|
||||
{
|
||||
int k, len, default_lvl = -1;
|
||||
|
@ -755,6 +757,10 @@ static Scheme_Object *get_log_level(char *prog, char *real_switch, const char *e
|
|||
l = scheme_make_null();
|
||||
|
||||
while (1) {
|
||||
while (*str && isspace(*str)) {
|
||||
str++;
|
||||
}
|
||||
|
||||
if (!*str) {
|
||||
if (default_lvl == -1) default_lvl = 0;
|
||||
if (last)
|
||||
|
@ -792,13 +798,13 @@ static Scheme_Object *get_log_level(char *prog, char *real_switch, const char *e
|
|||
if (k != -1) {
|
||||
if (*str == '@') {
|
||||
str++;
|
||||
for (s = str; *s && *s != ' '; s++) {
|
||||
for (s = str; *s && !isspace(*s); s++) {
|
||||
}
|
||||
l = scheme_make_pair(scheme_make_sized_byte_string(str, s - str, 1), l);
|
||||
if (!last) last = l;
|
||||
l = scheme_make_pair(scheme_make_integer(k), l);
|
||||
str = s;
|
||||
} else if ((*str == ' ') || !*str) {
|
||||
} else if (isspace(*str) || !*str) {
|
||||
if (default_lvl == -1)
|
||||
default_lvl = k;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user