mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
Reporter warnings and error now print to stderr by default.
- Changed the geoip warnings to Info.
This commit is contained in:
parent
e3f6a467a4
commit
5607e86ad3
2 changed files with 24 additions and 6 deletions
|
@ -36,24 +36,42 @@ export {
|
||||||
## Not all reporter messages will have locations in them though.
|
## Not all reporter messages will have locations in them though.
|
||||||
location: string &log &optional;
|
location: string &log &optional;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
## Send reporter error messages to STDERR by default. The option to
|
||||||
|
## turn it off is presented here in case Bro is being run by some
|
||||||
|
## external harness and shouldn't output anything to the console.
|
||||||
|
const errors_to_stderr = T &redef;
|
||||||
|
|
||||||
|
## Send reporter warning messages to STDERR by default. The option to
|
||||||
|
## turn it off is presented here in case Bro is being run by some
|
||||||
|
## external harness and shouldn't output anything to the console.
|
||||||
|
const warnings_to_stderr = T &redef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
global stderr: file;
|
||||||
|
|
||||||
event bro_init() &priority=5
|
event bro_init() &priority=5
|
||||||
{
|
{
|
||||||
Log::create_stream(Reporter::LOG, [$columns=Info]);
|
Log::create_stream(Reporter::LOG, [$columns=Info]);
|
||||||
|
|
||||||
|
if ( errors_to_stderr || warnings_to_stderr )
|
||||||
|
stderr = open("/dev/stderr");
|
||||||
}
|
}
|
||||||
|
|
||||||
event reporter_info(t: time, msg: string, location: string)
|
event reporter_info(t: time, msg: string, location: string) &priority=-5
|
||||||
{
|
{
|
||||||
Log::write(Reporter::LOG, [$ts=t, $level=INFO, $message=msg, $location=location]);
|
Log::write(Reporter::LOG, [$ts=t, $level=INFO, $message=msg, $location=location]);
|
||||||
}
|
}
|
||||||
|
|
||||||
event reporter_warning(t: time, msg: string, location: string)
|
event reporter_warning(t: time, msg: string, location: string) &priority=-5
|
||||||
{
|
{
|
||||||
Log::write(Reporter::LOG, [$ts=t, $level=WARNING, $message=msg, $location=location]);
|
Log::write(Reporter::LOG, [$ts=t, $level=WARNING, $message=msg, $location=location]);
|
||||||
}
|
}
|
||||||
|
|
||||||
event reporter_error(t: time, msg: string, location: string)
|
event reporter_error(t: time, msg: string, location: string) &priority=-5
|
||||||
{
|
{
|
||||||
|
if ( errors_to_stderr )
|
||||||
|
print stderr, fmt("ERROR: %s", msg);
|
||||||
|
|
||||||
Log::write(Reporter::LOG, [$ts=t, $level=ERROR, $message=msg, $location=location]);
|
Log::write(Reporter::LOG, [$ts=t, $level=ERROR, $message=msg, $location=location]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3764,7 +3764,7 @@ static GeoIP* open_geoip_db(GeoIPDBTypes type)
|
||||||
geoip = GeoIP_open_type(type, GEOIP_MEMORY_CACHE);
|
geoip = GeoIP_open_type(type, GEOIP_MEMORY_CACHE);
|
||||||
|
|
||||||
if ( ! geoip )
|
if ( ! geoip )
|
||||||
reporter->Warning("Failed to open GeoIP database: %s",
|
reporter->Info("Failed to open GeoIP database: %s",
|
||||||
GeoIPDBFileName[type]);
|
GeoIPDBFileName[type]);
|
||||||
return geoip;
|
return geoip;
|
||||||
}
|
}
|
||||||
|
@ -3804,7 +3804,7 @@ function lookup_location%(a: addr%) : geo_location
|
||||||
if ( ! geoip )
|
if ( ! geoip )
|
||||||
builtin_error("Can't initialize GeoIP City/Country database");
|
builtin_error("Can't initialize GeoIP City/Country database");
|
||||||
else
|
else
|
||||||
reporter->Warning("Fell back to GeoIP Country database");
|
reporter->Info("Fell back to GeoIP Country database");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
have_city_db = true;
|
have_city_db = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue