5 Test if the log summary is shown correctly in all cases
8 from basf2
import create_path, process, Module, logging, LogLevel, LogInfo, \
9 B2WARNING, B2FATAL, B2ERROR
10 import multiprocessing
13 def fork_process(*args, target=process):
14 """Run function in forked child to eliminate side effects"""
15 sub = multiprocessing.Process(target=target, args=args)
21 """Simple module to just print a warning, an error and a fatal error"""
27 B2FATAL(
"fatal error")
30 logging.log_level = LogLevel.WARNING
31 for level
in LogLevel.values.values():
32 logging.set_info(level, LogInfo.LEVEL | LogInfo.MODULE | LogInfo.PACKAGE | LogInfo.MESSAGE)
35 main.add_module(
"EventInfoSetter")
38 print(
"run in default settings")
41 print(
"run with no warnings")
42 logging.log_level = LogLevel.ERROR
44 logging.log_level = LogLevel.WARNING
46 print(
"run with no framework warnings")
47 logging.package(
"framework").log_level = LogLevel.ERROR
49 logging.package(
"framework").log_level = LogLevel.WARNING
51 print(
"run with no module warnings")
52 module.set_log_level(LogLevel.ERROR)
54 module.set_log_level(LogLevel.WARNING)
56 print(
"run without summary")
57 logging.enable_summary(
False)