zeek/testing/btest/scripts/base/frameworks/logging/print-log-stdout.zeek
Jon Siwek 30d0b21ecc Merge remote-tracking branch 'origin/topic/dev/print-to-log'
Adjustments during merge:

- kept the UNKNOWN Log::ID as placeholder value
- changed the coverage.find-bro-logs test to check for arbitrary $path
  field values instead of just string literals
- don't force EnumVal to unsigned integer since the relevant union member
  is the signed integer and added the relevant enum values/types to
  .bif files for easier access
- compare FILE* versus file name to check for stdout equality (don't
  think it matters much, just a bit more efficient)
- minor whitespace/style tweaks

* origin/topic/dev/print-to-log:
  Added a non boolean configuration and other changes as suggested by Jon
  Allow Print Statements to be redirected to a Log# This is a combination of 3 commits.
2019-12-02 13:47:09 -08:00

25 lines
486 B
Text

#
# @TEST-EXEC: zeek -b %INPUT
# @TEST-EXEC: btest-diff print.log
# @TEST-EXEC: btest-diff .stdout
# @TEST-EXEC: btest-diff otherfile
# @TEST-EXEC: btest-diff anotherfile
redef Log::print_to_log = Log::REDIRECT_STDOUT;
event zeek_init()
{
local f = open("otherfile");
print f, "hello world ,";
print "hello world ,";
print f,2,T;
print 2,T;
close(f);
}
event Log::log_print (rec: Log::PrintLogInfo)
{
local f = open("anotherfile");
print f,"from event",rec;
close(f);
}