Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding default log configurations for some options #15854

Open
qiuzhong opened this issue Mar 15, 2019 · 0 comments
Open

Consider adding default log configurations for some options #15854

qiuzhong opened this issue Mar 15, 2019 · 0 comments

Comments

@qiuzhong
Copy link
Contributor

There are needs to set default log configurations before passing them to setup_logging for ./wpt run. Here are some examples:

All the log-related options are passed to setup_logging function to set up the logger.

Meanwhile, the setup_logging removes all the log_* items from args after setting up the logger:

for name in args.keys():
if name.startswith("log_"):
args.pop(name)

The args then is passed to wptserver. As a reults, in #15012: --log-*-level was not passed to wptserve module, as the wpt server has a log filter and it doesn't know anything of the log configuration from command line at the wpt server side:

def setup_server_logging(self):
server_logger = get_default_logger(component="wptserve")
assert server_logger is not None
log_filter = handlers.LogLevelFilter(lambda x:x, "info")
# Downgrade errors to warnings for the server
log_filter = LogLevelRewriter(log_filter, ["error"], "warning")
server_logger.component_filter = log_filter
server_logger = proxy.QueuedProxyLogger(server_logger)
try:
#Set as the default logger for wptserve
serve.set_logger(server_logger)
serve.logger = server_logger
except Exception:
# This happens if logging has already been set up for wptserve
pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants